From 7f32560a93500777a877fd8f30a21c994662ae65 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 8 Apr 2023 18:18:32 -0300 Subject: content: generatePageLayout: footer :sparkles: --- src/content/dependencies/generatePageLayout.js | 43 ++++++++++++++++++++++++-- src/content/dependencies/index.js | 2 +- 2 files changed, 42 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js index 9abac0a2..98b2d350 100644 --- a/src/content/dependencies/generatePageLayout.js +++ b/src/content/dependencies/generatePageLayout.js @@ -1,15 +1,33 @@ export default { + contentDependencies: [ + 'generateFooterLocalizationLinks', + ], + extraDependencies: [ + 'cachebust', 'html', 'language', 'to', + 'transformMultiline', + 'wikiInfo', ], - generate({ + relations(relation) { + const relations = {}; + + relations.footerLocalizationLinks = + relation('generateFooterLocalizationLinks'); + + return relations; + }, + + generate(relations, { cachebust, html, language, to, + transformMultiline, + wikiInfo, }) { return html.template({ annotation: 'generatePageLayout', @@ -19,6 +37,7 @@ export default { cover: {type: 'html'}, mainContent: {type: 'html'}, + footerContent: {type: 'html'}, socialEmbed: {type: 'html'}, headingMode: { @@ -58,6 +77,12 @@ export default { } } + let footerContent = slots.footerContent; + + if (html.isBlank(footerContent) && wikiInfo.footerContent) { + footerContent = transformMultiline(wikiInfo.footerContent); + } + const mainHTML = html.tag('main', { id: 'content', @@ -75,6 +100,20 @@ export default { slots.mainContent), ]); + const footerHTML = + html.tag('footer', + {[html.onlyIfContent]: true, id: 'footer'}, + [ + html.tag('div', + { + [html.onlyIfContent]: true, + class: 'footer-content', + }, + footerContent), + + relations.footerLocalizationLinks, + ]); + const layoutHTML = [ // navHTML, // banner.position === 'top' && bannerHTML, @@ -97,7 +136,7 @@ export default { // sidebarRightHTML, ]), // banner.position === 'bottom' && bannerHTML, - // footerHTML, + footerHTML, ].filter(Boolean).join('\n'); const documentHTML = html.tags([ diff --git a/src/content/dependencies/index.js b/src/content/dependencies/index.js index d5ac082f..1210d78e 100644 --- a/src/content/dependencies/index.js +++ b/src/content/dependencies/index.js @@ -156,7 +156,7 @@ export function watchContentDependencies({ break main; } - if (logging && contentDependencies[functionName]) { + if (logging && initialScanComplete) { const timestamp = new Date().toLocaleString('en-US', {timeStyle: 'medium'}); console.log(color.green(`[${timestamp}] Updated ${functionName}`)); } -- cgit 1.3.0-6-gf8a5