Merge pull request #169 from myml/authors

feat: Support to show the authors of the article
This commit is contained in:
Dmitry Kolosov 2023-04-24 20:17:05 +02:00 committed by GitHub
commit b53b8dea2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 8 deletions

View File

@ -494,6 +494,18 @@ article header h1 a {
margin-right: 1em; margin-right: 1em;
} }
.post-authors {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
}
.post-authors li {
display: inline;
margin-right: 1em;
}
article img { article img {
max-width: 100%; max-width: 100%;
display: block; display: block;

View File

@ -89,6 +89,7 @@ locale = "pl-pl"
[taxonomies] [taxonomies]
category = "categories" category = "categories"
tag = "tags" tag = "tags"
author = "authors"
[markup.goldmark.renderer] [markup.goldmark.renderer]
unsafe = true unsafe = true

View File

@ -13,6 +13,7 @@ categories = [
"themes", "themes",
"syntax", "syntax",
] ]
authors = ["Mitrichius", "hugo"]
aliases = ["migrate-from-jekyl"] aliases = ["migrate-from-jekyl"]
favorite = true favorite = true
+++ +++

View File

@ -7,6 +7,7 @@ tags = [
"markdown", "markdown",
"text", "text",
] ]
authors = ["hugo"]
+++ +++
Lorem est tota propiore conpellat pectoribus de Lorem est tota propiore conpellat pectoribus de

View File

@ -16,6 +16,9 @@ toOldPosts:
tag: tag:
other: "tag" other: "tag"
author:
other: "author"
Tags: Tags:
other: "Tags" other: "Tags"
@ -31,6 +34,9 @@ Categories:
toAllTags: toAllTags:
other: "to all tags" other: "to all tags"
toAllAuthors:
other: "to all authors"
toAllCategories: toAllCategories:
other: "to all categories" other: "to all categories"

View File

@ -16,6 +16,9 @@ toOldPosts:
tag: tag:
other: "标签" other: "标签"
author:
other: "作者"
Tags: Tags:
other: "标签" other: "标签"
@ -31,6 +34,9 @@ Categories:
toAllTags: toAllTags:
other: "所有标签" other: "所有标签"
toAllAuthors:
other: "所有作者"
toAllCategories: toAllCategories:
other: "所有类别" other: "所有类别"

View File

@ -29,5 +29,13 @@
{{ end }} {{ end }}
</ul> </ul>
{{ end }} {{ end }}
{{ if .Params.authors }}
<ul class="post-authors">
{{ range $author_name := .Params.authors }}
{{ $author := ($.Site.GetPage (printf "/authors/%s" $author_name)) }}
<li><a href="{{ $author.Permalink }}">@{{ $author_name }}</a></li>
{{ end }}
</ul>
{{ end }}
</div> </div>
</div> </div>