Skip to content
Permalink
Browse files

add authors page

  • Loading branch information...
shaform committed Nov 17, 2018
1 parent 8c4c06b commit 37f5418768e955444e729808949ed2c49e8b0172
@@ -13,7 +13,8 @@
font-family: $global-serif-font-family;

&.tag,
&.category {
&.category,
&.author {
margin: 20px 0;
}

@@ -127,4 +128,4 @@
}
}
}
}
}
@@ -5,7 +5,7 @@ lastmod: 2017-08-30T15:43:48+08:00
draft: false
tags: ["preview", "English", "tag-2"]
categories: ["English", "index", "test"]
author: "Michael Henderson"
author: ted

# You can also close(false) or open(true) something for this content.
# P.S. comment can only be closed
@@ -18,4 +18,4 @@ contentCopyright: '<a href="https://github.com/gohugoio/hugoBasicExample" rel="n
# mathjax: false
---

This is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long title
This is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long titleThis is a very long title
@@ -0,0 +1,2 @@
[name]
display = "Ted Williams"
@@ -19,6 +19,12 @@ PygmentsUseClasses = true # Use CSS classes to format highlighted code
PygmentsCodefencesGuessSyntax = true
PygmentsOptions = "linenos=table"

# Enable author pages
#[taxonomies]
# author = "author"
# tag = "tags"
# category = "categories"

# language support # en / zh-cn / other... translations present in i18n/
defaultContentLanguage = "en" # Default language to use
[languages.en]
@@ -13,6 +13,12 @@
- id: category
translation: "Category: "

- id: authors
translation: Authors

- id: author_item
translation: "Author: "

# posts
- id: prev
translation: Prev
@@ -13,6 +13,12 @@
- id: category
translation: "分类: "

- id: authors
translation: 文章作者

- id: author_item
translation: "文章作者: "

# posts
- id: prev
translation: 上一页
@@ -13,6 +13,12 @@
- id: category
translation: "分類: "

- id: authors
translation: 文章作者

- id: author_item
translation: "文章作者: "

# posts
- id: prev
translation: 上一頁
@@ -1,4 +1,10 @@
{{ define "title" }}{{ .Title }} · {{ .Site.Title }}{{ end }}
{{ define "title" -}}
{{ if eq .Data.Singular "author" -}}
{{ (index $.Site.Data.authors .Title).name.display | default .Title }} · {{ .Site.Title }}
{{- else -}}
{{ .Title }} · {{ .Site.Title }}
{{- end }}
{{- end }}

{{ define "content"}}
{{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "post") (index .Site.Params "archive-paginate" | default 10) }}
@@ -12,6 +18,10 @@ <h2 class="archive-name">{{ i18n "tag" }}{{ .Title }}</h2>
<div class="archive-title category">
<h2 class="archive-name">{{ i18n "category" }}{{ .Title }}</h2>
</div>
{{ else if eq .Data.Singular "author" }}
<div class="archive-title author">
<h2 class="archive-name">{{ i18n "author_item" }}{{ (index $.Site.Data.authors .Title).name.display | default .Title }}</h2>
</div>
{{ end }}
{{ end }}

@@ -74,6 +74,44 @@ <h2 class="archive-year">
{{ end }}
</div>
</div>
<!-- Author Page -->
{{ else if and $.Site.Taxonomies.author (eq $termName "author") }}
{{ range $terms }}
{{ $term := .Term }}
{{ $pages := .Pages }}
{{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) }}
<section id="archive" class="archive">
<div class="archive-title">
</div>
<div class="collection-title">
<h2 class="archive-year">
<a href="{{ .Permalink }}">
{{ i18n "author_item" }}{{ (index $.Site.Data.authors $term).name.display | default $term }}
</a>
</h2>
</div>

{{ range first 5 $pages }}
<div class="archive-post">
<time datetime="{{ .Date.Format "2006-01-02" }}" class="archive-post-time">
{{ .Date.Format "2006-01-02" }}
</time>
<span class="archive-post-title">
<a href="{{ .URL }}" class="archive-post-link">
{{ .Title }}
</a>
</span>
</div>
{{ end }}
{{ if gt (len $pages) 5 }}
<div class="more-post">
<a href="{{ .Permalink }}" class="more-post-link">{{ i18n "morePost" }}</a>
</div>
{{ end }}
</section>
{{ end }}
{{ end }}

{{ end }}

{{ end }}
@@ -24,7 +24,7 @@

<!-- author & description & keywords -->
{{- if or .Params.author .Site.Author.name -}}
<meta name="author" content="{{ if .Params.author }}{{ .Params.author | safeHTML }}{{ else }}{{ .Site.Author.name | safeHTML }}{{ end }}" />
<meta name="author" content="{{ (index .Site.Data.authors (.Params.author | default .Site.Author.name)).name.display | default .Params.author | default .Site.Author.name | safeHTML }}" />
{{- end -}}

{{- if .Description -}}
@@ -2,7 +2,15 @@
<div class="post-copyright">
<p class="copyright-item">
<span class="item-title">{{ i18n "author" }}</span>
<span class="item-content">{{ if .Params.author }}{{ .Params.author | safeHTML }}{{ else }}{{ .Site.Author.name | safeHTML }}{{ end }}</span>
<span class="item-content">
{{- $author_id := .Params.author | default .Site.Author.name -}}
{{- $author_name := (index $.Site.Data.authors $author_id).name.display | default $author_id -}}
{{- with $.Site.GetPage "taxonomy" (printf "author/%s" $author_id) -}}
<a href="{{ .Permalink }}">{{ $author_name | safeHTML }}</a>
{{- else -}}
{{- $author_name | safeHTML -}}
{{- end -}}
</span>
</p>
<p class="copyright-item">
<span class="item-title">{{ i18n "lastMod" }}</span>
@@ -27,4 +35,4 @@
</span>
</p>
</div>
{{- end }}
{{- end }}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1 +1 @@
{"Target":"sass/jane.min.5bd6da7fa14a03e8d44cce2638cae75d5bc309c45559e672425454d043458981.css","MediaType":"text/css","Data":{"Integrity":"sha256-W9baf6FKA+jUTM4mOMrnXVvDCcRVWeZyQlRU0ENFiYE="}}
{"Target":"sass/jane.min.14adaa9e98ff1655bafd0728e49aaeec54413095a880475b7621f14ae200d777.css","MediaType":"text/css","Data":{"Integrity":"sha256-FK2qnpj/FlW6/Qco5Jqu7FRBMJWogEdbdiHxSuIA13c="}}

0 comments on commit 37f5418

Please sign in to comment.
You can’t perform that action at this time.