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

github.com/devcows/hugo-universal-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gisbers <michael@gisbers.de>2021-08-04 16:55:35 +0300
committerGitHub <noreply@github.com>2021-08-04 16:55:35 +0300
commit965e6c27a31f735d4ca260877fed02ea62f0b7d3 (patch)
tree21298d39badc38f0308539e9b33629477432c0a7
parent0f9faf74727f63189901d93b98945c28b0e1d1df (diff)
Use authors taxonomy and list all posts on a draft user's page (#306)1.2.0
* add taxonomies to config.toml * change blog posts to use 'authors' instead of 'author'; add author 'Jane Doe' * draft for user page listing all user posts * change from using 'author' to 'authors' * remove space before comma for multiple authors * remove authors/list.html to get same look like tags/categories listing
-rw-r--r--exampleSite/config.toml5
-rw-r--r--exampleSite/content/blog/categories-post.md2
-rw-r--r--exampleSite/content/blog/creating-a-new-theme.md1
-rw-r--r--exampleSite/content/blog/linked-post.md2
-rw-r--r--layouts/_default/list.html4
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/partials/recent_posts.html4
7 files changed, 15 insertions, 7 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index c4fda7a..b7276db 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -199,3 +199,8 @@ paginate = 10
title = "From our blog"
subtitle = "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo."
hide_summary = false
+
+[taxonomies]
+ category = "categories"
+ tag = "tags"
+ author = "authors"
diff --git a/exampleSite/content/blog/categories-post.md b/exampleSite/content/blog/categories-post.md
index 01eb130..55f2b78 100644
--- a/exampleSite/content/blog/categories-post.md
+++ b/exampleSite/content/blog/categories-post.md
@@ -4,7 +4,7 @@ date = "2021-08-01T21:29:20+02:00"
tags = ["golang", "programming", "theme", "hugo"]
categories = ["programming","lorem","pseudo"]
banner = "img/banners/banner-4.jpg"
-author = "John Doe"
+authors = ["John Doe"]
+++
I'm a post with multiple categories in the frontmatter:
diff --git a/exampleSite/content/blog/creating-a-new-theme.md b/exampleSite/content/blog/creating-a-new-theme.md
index 799a813..233b293 100644
--- a/exampleSite/content/blog/creating-a-new-theme.md
+++ b/exampleSite/content/blog/creating-a-new-theme.md
@@ -5,6 +5,7 @@ tags = ["theme"]
categories = ["starting"]
description = "This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content."
banner = "img/banners/banner-1.jpg"
+authors = ["Jane Doe"]
+++
## Introduction
diff --git a/exampleSite/content/blog/linked-post.md b/exampleSite/content/blog/linked-post.md
index f2793d1..6463eca 100644
--- a/exampleSite/content/blog/linked-post.md
+++ b/exampleSite/content/blog/linked-post.md
@@ -4,7 +4,7 @@ date = "2015-10-02T21:49:20+02:00"
tags = ["golang", "programming", "theme", "hugo"]
categories = ["programming"]
banner = "img/banners/banner-4.jpg"
-author = "John Doe"
+authors = ["John Doe","Jane Doe"]
+++
I'm a linked post in the menu. You can add other posts by adding the following line to the frontmatter:
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 1b80b75..ba95831 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -37,8 +37,8 @@
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class="clearfix">
<p class="author-category">
- {{ if isset .Params "author" }}
- {{ i18n "authorBy" }} <a href="#">{{ .Params.author }}</a>
+ {{ if isset .Params "authors" }}
+ {{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
{{ end }}
{{ if isset .Params "categories" }}
{{ if gt (len .Params.categories) 0 }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 29f2dd0..a04e456 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -22,7 +22,9 @@
{{ if or .Params.author .Params.date }}
<p class="text-muted text-uppercase mb-small text-right">
- {{ if .Params.author }}{{ i18n "authorBy" }} <a href="#">{{ .Params.author }}</a>{{ end }}
+ {{ if isset .Params "authors" }}
+ {{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
+ {{ end }}
{{ if and .Params.author .Params.date }} | {{ end }}
{{ if .Params.date }}{{ .Date.Format .Site.Params.date_format }}{{ end }}
</p>
diff --git a/layouts/partials/recent_posts.html b/layouts/partials/recent_posts.html
index f16b272..d60fb8c 100644
--- a/layouts/partials/recent_posts.html
+++ b/layouts/partials/recent_posts.html
@@ -38,8 +38,8 @@
<div class="content">
<h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4>
<p class="author-category">
- {{ with .Params.author }}
- {{ i18n "authorBy" }} <a href="#">{{ . }}</a>
+ {{ if isset .Params "authors" }}
+ {{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
{{ end }}
{{ i18n "publishedOn" }} {{ .Date.Format .Site.Params.date_format }}
</p>