don't use outPath any more

- links are constructed explicitly, relative to the current page's
location
- templates are called explicitly by output type
This commit is contained in:
Valentin Gagarin 2024-11-13 15:24:41 +01:00 committed by Valentin Gagarin
parent e2691f8469
commit c7a13f04c9
2 changed files with 2 additions and 13 deletions

View file

@ -42,7 +42,7 @@ in
head = '' head = ''
<title>${page.title}</title> <title>${page.title}</title>
<meta name="description" content="${page.description}" /> <meta name="description" content="${page.description}" />
<link rel="canonical" href="${page.outPath}" /> <link rel="canonical" href="${lib.head page.locations}" />
''; '';
body = '' body = ''
${config.menus.main.outputs.html page} ${config.menus.main.outputs.html page}

View file

@ -14,9 +14,6 @@ in
type = types.str; type = types.str;
default = name; default = name;
}; };
# TODO: reconsider using `page.outPath` and what to put into `locations`.
# maybe we can avoid having ".html" suffixes there.
# since templates can output multiple files, `html` is merely one of many things we *could* produce.
locations = mkOption { locations = mkOption {
description = '' description = ''
List of historic output locations for the resulting file List of historic output locations for the resulting file
@ -46,15 +43,7 @@ in
# TODO: we may want links to other representations, # TODO: we may want links to other representations,
# and currently the mapping of output types to output file # and currently the mapping of output types to output file
# names is soft. # names is soft.
default = target: with lib; "${relativePath config.outPath target.outPath}.html"; default = target: with lib; "${relativePath (head config.locations) (head target.locations)}.html";
};
# TODO: may not need it when using `link`; could repurpose it to render the default template
outPath = mkOption {
description = ''
Location of the page, used for transparently creating links
'';
type = types.str;
default = lib.head config.locations;
}; };
outputs = mkOption { outputs = mkOption {
description = '' description = ''