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;
}
.post-authors {
display: inline;
list-style-type: none;
padding: 0;
margin: 0;
}
.post-authors li {
display: inline;
margin-right: 1em;
}
article img {
max-width: 100%;
display: block;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,5 +29,13 @@
{{ end }}
</ul>
{{ 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>