From fbaafdfe97392e87a712829d1766de2e0834dbd3 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Sun, 19 Mar 2023 10:36:01 -0400 Subject: [PATCH] add 'see also' section to bottom of single pages ; setup blog post config in cms configs ; update slugs for blog in hugo config --- config.toml | 2 +- content/posts/2023-03-18-first-post.md | 21 ++++----- content/posts/2023-03-19-test.md | 15 +++++++ themes/hugo-xmin/layouts/_default/single.html | 15 +++++++ .../hugo-xmin/static/admin/desktop/config.yml | 44 ++++++++++++++++--- .../hugo-xmin/static/admin/mobile/config.yml | 38 +++++++++++++--- 6 files changed, 110 insertions(+), 25 deletions(-) create mode 100644 content/posts/2023-03-19-test.md diff --git a/config.toml b/config.toml index fa0cebf..b260b1a 100644 --- a/config.toml +++ b/config.toml @@ -19,7 +19,7 @@ footnotereturnlinkcontents = '↩' uglyURLs = false [permalinks] tips = '/tips/:slug/' - posts = '/posts/:slug/' + posts = '/posts/:year-:month-:day-:slug/' tags = '/tags/:title/' [sitemap] diff --git a/content/posts/2023-03-18-first-post.md b/content/posts/2023-03-18-first-post.md index b715079..61ea8f7 100644 --- a/content/posts/2023-03-18-first-post.md +++ b/content/posts/2023-03-18-first-post.md @@ -1,12 +1,13 @@ -+++ -title = "First Post" -author = "KemoNine" -publishDate = 2023-03-18 -lastmod = 2023-03-18 -draft = false -categories = [ - "blog" -] -+++ +--- +layout: post +title: First Post +author: KemoNine +pubDate: 2023-03-18 +modDate: 2023-03-18 +toc: false +draft: false +categories: + - blog +--- The site has been created and more details will be published as time permits. diff --git a/content/posts/2023-03-19-test.md b/content/posts/2023-03-19-test.md new file mode 100644 index 0000000..3f40055 --- /dev/null +++ b/content/posts/2023-03-19-test.md @@ -0,0 +1,15 @@ +--- +layout: post +title: test +author: test +pubDate: 2023-03-19T16:24:50.215Z +modDate: 2023-03-19T16:24:50.238Z +toc: true +draft: false +categories: + - blog +tags: + - tag: test 1 + - tag: test 2 +--- +test \ No newline at end of file diff --git a/themes/hugo-xmin/layouts/_default/single.html b/themes/hugo-xmin/layouts/_default/single.html index e9944ff..046b68d 100644 --- a/themes/hugo-xmin/layouts/_default/single.html +++ b/themes/hugo-xmin/layouts/_default/single.html @@ -21,4 +21,19 @@ {{ .Content }} +{{ range first 1 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }} + {{ $.Scratch.Set "has_related" true }} +{{ end }} + +{{ if $.Scratch.Get "has_related" }} +

See Also

+ Back to top + +{{ end }} + {{ partial "footer.html" . }} diff --git a/themes/hugo-xmin/static/admin/desktop/config.yml b/themes/hugo-xmin/static/admin/desktop/config.yml index 7333a48..691425c 100644 --- a/themes/hugo-xmin/static/admin/desktop/config.yml +++ b/themes/hugo-xmin/static/admin/desktop/config.yml @@ -1,18 +1,48 @@ +site_url: https://kb.accessible.tips +display_url: https://kb.accessible.tips + media_folder: "static/uploads" public_folder: "/uploads" + +search: false + backend: name: git-gateway branch: main + collections: - name: "blog" # Used in routes, e.g., /admin/collections/blog label: "Blog" # Used in the UI - folder: "_posts/blog" # The path to the folder where the documents are stored + folder: "content/posts" # The path to the folder where the documents are stored create: true # Allow users to create new documents in this collection slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md + show_preview_links: true + preview_path: "posts/{{slug}}" fields: # The fields for each document, usually in front matter - - {label: "Layout", name: "layout", widget: "hidden", default: "blog"} - - {label: "Title", name: "title", widget: "string"} - - {label: "Publish Date", name: "date", widget: "datetime"} - - {label: "Featured Image", name: "thumbnail", widget: "image"} - - {label: "Rating (scale of 1-5)", name: "rating", widget: "number"} - - {label: "Body", name: "body", widget: "markdown"} + - {label: "Layout", name: "layout", widget: "hidden", default: "post", required: true} + - {label: "Title", name: "title", widget: "string", required: true} + - {label: "Author", name: "author", widget: "string", required: true} + - {label: "Publish Date", name: "pubDate", widget: "datetime", date_format: 'yyyy-MM-dd', time_format: false, required: true} + - {label: "Last Modified", name: "modDate", widget: "datetime", date_format: 'yyyy-MM-dd', time_format: false, required: true} + - {label: "Show TOC?", name: "toc", widget: "boolean", default: true} + - {label: "Draft?", name: "draft", widget: "boolean", default: true} + - name: categories + label: Categories + widget: list + allow_add: false + default: + - 'blog' + fields: + - name: category + label: Category + widget: string + - name: tags + label: Tags + widget: list + required: true + collapsed: false + fields: + - name: tag + label: Tag + widget: string + - {label: "Body", name: "body", widget: "markdown", required: true} diff --git a/themes/hugo-xmin/static/admin/mobile/config.yml b/themes/hugo-xmin/static/admin/mobile/config.yml index 7333a48..b0a4f53 100644 --- a/themes/hugo-xmin/static/admin/mobile/config.yml +++ b/themes/hugo-xmin/static/admin/mobile/config.yml @@ -1,18 +1,42 @@ +site_url: https://kb.accessible.tips +display_url: https://kb.accessible.tips + media_folder: "static/uploads" public_folder: "/uploads" + +search: false + backend: name: git-gateway branch: main + collections: - name: "blog" # Used in routes, e.g., /admin/collections/blog label: "Blog" # Used in the UI - folder: "_posts/blog" # The path to the folder where the documents are stored + folder: "content/posts" # The path to the folder where the documents are stored create: true # Allow users to create new documents in this collection slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md + show_preview_links: true + preview_path: "posts/{{slug}}" fields: # The fields for each document, usually in front matter - - {label: "Layout", name: "layout", widget: "hidden", default: "blog"} - - {label: "Title", name: "title", widget: "string"} - - {label: "Publish Date", name: "date", widget: "datetime"} - - {label: "Featured Image", name: "thumbnail", widget: "image"} - - {label: "Rating (scale of 1-5)", name: "rating", widget: "number"} - - {label: "Body", name: "body", widget: "markdown"} + - {label: "Layout", name: "layout", widget: "hidden", default: "post", required: true} + - {label: "Title", name: "title", widget: "string", required: true} + - {label: "Author", name: "author", widget: "string", required: true} + - {label: "Publish Date", name: "pubDate", widget: "datetime", date_format: 'YYYY-MM-DD', time_format: false, required: true} + - {label: "Last Modified", name: "modDate", widget: "datetime", date_format: 'YYYY-MM-DD', time_format: false, required: true} + - {label: "Show TOC?", name: "toc", widget: "boolean", default: true} + - {label: "Draft?", name: "draft", widget: "boolean", default: true} + - label: "Categories" + name: "categories" + widget: "list" + allow_add: false + default: ["blog"] + - label: "Tags" + name: "tags" + widget: "list" + fields: + - label: "Tag" + name: "tag" + widget: "string" + required: true + - {label: "Body", name: "body", widget: "markdown", required: true}