« get me outta code hell

content: generatePageLayout: nicer attributes for nav links - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-23 13:59:29 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-24 15:03:10 -0300
commit32ede21ad373affca6a6c5d4c92521e786d65a94 (patch)
tree8ea930b10095d2154751a9eee2cce0cb09988ea0
parent85aa05bd5b030fcd7de33c25ec65f70582d903e3 (diff)
content: generatePageLayout: nicer attributes for nav links
-rw-r--r--src/content/dependencies/generatePageLayout.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index fd2ebdc7..94827568 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -327,28 +327,26 @@ export default {
                 if (cur.html) {
                   content = cur.html;
                 } else {
+                  const attributes = html.attributes();
                   let title;
-                  let href;
 
                   switch (cur.auto) {
                     case 'home':
                       title = data.wikiName;
-                      href = to('localized.home');
+                      attributes.set('href', to('localized.home'));
                       break;
                     case 'current':
                       title = slots.title;
-                      href = '';
+                      attributes.set('href', '');
                       break;
                     case null:
                     case undefined:
                       title = cur.title;
-                      href = to(...cur.path);
+                      attributes.set('href', to(...cur.path));
                       break;
                   }
 
-                  content = html.tag('a',
-                    {href},
-                    title);
+                  content = html.tag('a', attributes, title);
                 }
 
                 const showAsCurrent =