about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2023-11-10 12:35:06 +0100
committerAlan Pearce2023-11-10 12:35:06 +0100
commit9803beaca39fbccd38ab3a461a5e29d6e6d45c47 (patch)
treede374b4ebb82c67e0e3ee39ea1065e2c14742791
parent06300f6a1dfb3e00bc7e71a229f334aa0626f8ed (diff)
downloadwebsite-9803beaca39fbccd38ab3a461a5e29d6e6d45c47.tar.lz
website-9803beaca39fbccd38ab3a461a5e29d6e6d45c47.tar.zst
website-9803beaca39fbccd38ab3a461a5e29d6e6d45c47.zip
Tweak menu configuration structure
-rw-r--r--config.toml10
-rw-r--r--src/templates.ts6
2 files changed, 8 insertions, 8 deletions
diff --git a/config.toml b/config.toml
index 9fd866d..a4345a0 100644
--- a/config.toml
+++ b/config.toml
@@ -34,18 +34,18 @@ cache-control = "max-age=14400"
 x-content-type-options = "nosniff"
 content-security-policy = "default-src 'none'; img-src 'self'; object-src 'none'; script-src 'self'; style-src 'unsafe-inline'; form-action 'none'; base-uri 'self'; frame-ancestors https://kagi.com;"
 
-[[extra.main_menu]]
+[[menus.main]]
     name = "Home"
     url = "/"
-[[extra.main_menu]]
+[[menus.main]]
     name = "Posts"
     url = "/post/"
-[[extra.main_menu]]
+[[menus.main]]
     name = "Feed"
     url = "/atom.xml"
-[[extra.main_menu]]
+[[menus.main]]
     name = "Tags"
     url = "/tags/"
-[[extra.main_menu]]
+[[menus.main]]
     name = "Repositories"
     url = "https://git.alanpearce.eu"
diff --git a/src/templates.ts b/src/templates.ts
index 0a0de83..a134723 100644
--- a/src/templates.ts
+++ b/src/templates.ts
@@ -17,7 +17,7 @@ function addMenu(
   child: cheerio.Cheerio<cheerio.AnyNode>,
 ) {
   parent.empty();
-  for (const link of config.extra.main_menu) {
+  for (const link of config.menus.main) {
     parent.append(child.clone().attr("href", link.url).text(link.name));
   }
 }
@@ -57,10 +57,10 @@ async function renderHomepage(posts: Array<Post>): Promise<string> {
   $(".title").addClass("p-name").addClass("u-url");
   $("#content").html(await marked.parse(file.content));
   const $feed = $(".h-feed");
-  const $tpl = $(".h-entry").remove();
+  const $entry = $(".h-entry").remove();
 
   for (const post of posts) {
-    const $post = $tpl.clone();
+    const $post = $entry.clone();
     $post.find(".p-name").text(post.title);
     $post.find(".u-url").attr("href", post.url);
     $post