Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jakewies/hugo-theme-codex.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Wiesler <jakewiesler@gmail.com>2020-06-26 16:22:38 +0300
committerJake Wiesler <jakewiesler@gmail.com>2020-06-26 16:22:38 +0300
commit4d446adb19c86df49d567d9e78b0edc496d38882 (patch)
tree5ddc2efab02d58ee3698cf0baacc53867c641d36
parentd20680efd400ea874b6f3a270ffbe6c1b1f1871e (diff)
refactor: check toc in post frontmatter
-rw-r--r--README.md32
-rw-r--r--archetypes/blog.md3
-rw-r--r--exampleSite/content/blog/example-post.md3
-rw-r--r--exampleSite/content/blog/markdown-syntax.md3
-rw-r--r--exampleSite/content/blog/math-typesetting.md2
-rw-r--r--exampleSite/content/blog/rich-content.md3
-rw-r--r--layouts/_default/single.html4
7 files changed, 39 insertions, 11 deletions
diff --git a/README.md b/README.md
index 29b643d..2b4321b 100644
--- a/README.md
+++ b/README.md
@@ -92,13 +92,37 @@ You can create a new blog post page by going to the root of your project and typ
hugo new blog/:blog-post.md
```
-Where `:blog-post.md` is the name of the file of your new post.
+Where `:blog-post.md` is the name of the file of your new post.
-Optional parameters for your post, added by the theme:
+This will execute the theme's `blog` archetype to create a new markdown file in `contents/blog/:blog-post.md` with the following frontmatter:
-* `math:true` enables math renderig with KaTeX
-* `toc: true` adds a table of contents to your post
+```md
+# Default post frontmatter:
+
+---
+# The title of your post. Default value is generated
+# From the markdown filename
+title: "{{ replace .TranslationBaseName "-" " " | title }}"
+# The date the post was created
+date: {{ .Date }}
+# The post filename
+slug: ""
+# Post description used for seo
+description: ""
+# Post keywords used for seo
+keywords: []
+# If true, the blog post will not be included in static build
+draft: true
+# Categorize your post with tags
+tags: []
+# Uses math typesetting
+math: false
+# Includes a table of contents
+toc: false
+---
+```
+The frontmatter above is the default for a new post, but all values can be changed.
### Adding a new section menu
diff --git a/archetypes/blog.md b/archetypes/blog.md
index 4c84b81..c5a2205 100644
--- a/archetypes/blog.md
+++ b/archetypes/blog.md
@@ -6,5 +6,6 @@ description: ""
keywords: []
draft: true
tags: []
-stylesheet: "post.css"
+math: false
+toc: false
---
diff --git a/exampleSite/content/blog/example-post.md b/exampleSite/content/blog/example-post.md
index e2f1dae..5f8b62b 100644
--- a/exampleSite/content/blog/example-post.md
+++ b/exampleSite/content/blog/example-post.md
@@ -6,7 +6,8 @@ description: "This is an example post for hugo-theme-codex."
keywords: ["gohugo", "hugo", "go", "blog"]
draft: false
tags: ["hugo"]
-stylesheet: "post.css"
+math: false
+toc: true
---
## The standard Lorem Ipsum passage
diff --git a/exampleSite/content/blog/markdown-syntax.md b/exampleSite/content/blog/markdown-syntax.md
index 8f71882..39b0b6d 100644
--- a/exampleSite/content/blog/markdown-syntax.md
+++ b/exampleSite/content/blog/markdown-syntax.md
@@ -6,7 +6,8 @@ description: "Sample article showcasing basic Markdown syntax and formatting for
keywords: ["gohugo", "hugo", "go", "blog"]
draft: false
tags: ["markdown", "css", "html", "themes"]
-stylesheet: "post.css"
+math: false
+toc: false
---
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
diff --git a/exampleSite/content/blog/math-typesetting.md b/exampleSite/content/blog/math-typesetting.md
index d8c8117..d7ce771 100644
--- a/exampleSite/content/blog/math-typesetting.md
+++ b/exampleSite/content/blog/math-typesetting.md
@@ -6,8 +6,8 @@ description: "A brief guide to setup KaTeX"
keywords: ["gohugo", "hugo", "go", "blog"]
draft: false
tags: ["math"]
-stylesheet: "post.css"
math: true
+toc: false
---
Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries.
diff --git a/exampleSite/content/blog/rich-content.md b/exampleSite/content/blog/rich-content.md
index 3f69a5f..c69a34b 100644
--- a/exampleSite/content/blog/rich-content.md
+++ b/exampleSite/content/blog/rich-content.md
@@ -6,7 +6,8 @@ description: "A brief description of Hugo Shortcodes"
keywords: ["gohugo", "hugo", "go", "blog"]
draft: false
tags: ["shortcodes"]
-stylesheet: "post.css"
+math: false
+toc: false
---
Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugo-s-built-in-shortcodes) for rich content, along with a [Privacy Config](https://gohugo.io/about/hugo-and-gdpr/) and a set of Simple Shortcodes that enable static and no-JS versions of various social media embeds.
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index cd3820e..bdbce10 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -27,7 +27,7 @@
</footer>
</div>
</div>
- {{ if or .Params.toc .Site.Params.toc }}
+ {{ if .Params.toc }}
<div class="toc-container">
{{ if .Site.Params.showPageTitleInTOC }} <div class="toc-post-title">{{ .Title }}</div> {{ end }}
{{ .TableOfContents }}
@@ -38,7 +38,7 @@
{{ end }}
{{ define "scripts" }}
- {{ if or .Params.toc .Site.Params.toc }}
+ {{ if .Params.toc }}
<script src="/js/table-of-contents.js"></script>
{{ end }}
<script src="https://unpkg.com/prismjs@^1.2"></script>