add 'see also' section to bottom of single pages ; setup blog post config in cms configs ; update slugs for blog in hugo config

This commit is contained in:
KemoNine 2023-03-19 10:36:01 -04:00
parent 51855b28bc
commit fbaafdfe97
6 changed files with 110 additions and 25 deletions

View file

@ -19,7 +19,7 @@ footnotereturnlinkcontents = '↩'
uglyURLs = false uglyURLs = false
[permalinks] [permalinks]
tips = '/tips/:slug/' tips = '/tips/:slug/'
posts = '/posts/:slug/' posts = '/posts/:year-:month-:day-:slug/'
tags = '/tags/:title/' tags = '/tags/:title/'
[sitemap] [sitemap]

View file

@ -1,12 +1,13 @@
+++ ---
title = "First Post" layout: post
author = "KemoNine" title: First Post
publishDate = 2023-03-18 author: KemoNine
lastmod = 2023-03-18 pubDate: 2023-03-18
draft = false modDate: 2023-03-18
categories = [ toc: false
"blog" draft: false
] categories:
+++ - blog
---
The site has been created and more details will be published as time permits. The site has been created and more details will be published as time permits.

View file

@ -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

View file

@ -21,4 +21,19 @@
{{ .Content }} {{ .Content }}
</main> </main>
{{ 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" }}
<h2>See Also</h2>
<a href="#top">Back to top</a>
<ul>
{{ $num_to_show := .Site.Params.related_content_limit | default 15 }}
{{ range first $num_to_show (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ partial "footer.html" . }} {{ partial "footer.html" . }}

View file

@ -1,18 +1,48 @@
site_url: https://kb.accessible.tips
display_url: https://kb.accessible.tips
media_folder: "static/uploads" media_folder: "static/uploads"
public_folder: "/uploads" public_folder: "/uploads"
search: false
backend: backend:
name: git-gateway name: git-gateway
branch: main branch: main
collections: collections:
- name: "blog" # Used in routes, e.g., /admin/collections/blog - name: "blog" # Used in routes, e.g., /admin/collections/blog
label: "Blog" # Used in the UI 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 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 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 fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"} - {label: "Layout", name: "layout", widget: "hidden", default: "post", required: true}
- {label: "Title", name: "title", widget: "string"} - {label: "Title", name: "title", widget: "string", required: true}
- {label: "Publish Date", name: "date", widget: "datetime"} - {label: "Author", name: "author", widget: "string", required: true}
- {label: "Featured Image", name: "thumbnail", widget: "image"} - {label: "Publish Date", name: "pubDate", widget: "datetime", date_format: 'yyyy-MM-dd', time_format: false, required: true}
- {label: "Rating (scale of 1-5)", name: "rating", widget: "number"} - {label: "Last Modified", name: "modDate", widget: "datetime", date_format: 'yyyy-MM-dd', time_format: false, required: true}
- {label: "Body", name: "body", widget: "markdown"} - {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}

View file

@ -1,18 +1,42 @@
site_url: https://kb.accessible.tips
display_url: https://kb.accessible.tips
media_folder: "static/uploads" media_folder: "static/uploads"
public_folder: "/uploads" public_folder: "/uploads"
search: false
backend: backend:
name: git-gateway name: git-gateway
branch: main branch: main
collections: collections:
- name: "blog" # Used in routes, e.g., /admin/collections/blog - name: "blog" # Used in routes, e.g., /admin/collections/blog
label: "Blog" # Used in the UI 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 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 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 fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"} - {label: "Layout", name: "layout", widget: "hidden", default: "post", required: true}
- {label: "Title", name: "title", widget: "string"} - {label: "Title", name: "title", widget: "string", required: true}
- {label: "Publish Date", name: "date", widget: "datetime"} - {label: "Author", name: "author", widget: "string", required: true}
- {label: "Featured Image", name: "thumbnail", widget: "image"} - {label: "Publish Date", name: "pubDate", widget: "datetime", date_format: 'YYYY-MM-DD', time_format: false, required: true}
- {label: "Rating (scale of 1-5)", name: "rating", widget: "number"} - {label: "Last Modified", name: "modDate", widget: "datetime", date_format: 'YYYY-MM-DD', time_format: false, required: true}
- {label: "Body", name: "body", widget: "markdown"} - {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}