Skip to content

Commit

Permalink
Add feature for displaying the author
Browse files Browse the repository at this point in the history
Now it is possible to display the author in the article with the additional
function 'authorlink' to provide a link to the website of the author.

  1. Enable with 'listAuthor = true' in config
  2. Front matter 'authorlink' enables a link to a website
  • Loading branch information
dataCobra committed Dec 20, 2019
1 parent e65de79 commit f244a1a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ For more explanation about some features, scroll down to **Features**
* **(+)** Multiple taxonomies work flawless with single post
* **(+)** New list of all taxonomies and tags below the post in single view
* **(+)** New array front matter notaxonomy
* **(+)** Author/Writer display in post with extra features
* Multilingual support for month names
* Syntax highlighting
* Custom CSS
Expand Down Expand Up @@ -167,7 +168,7 @@ under the post.

With the new front matter `notaxanomy` you can specify every taxonomy that
should **not be visible** below the content. You can also use the type page
as explained at **Content type** to disable the taxonomie view completely.
as explained at **Content type** to disable the taxonomie view completely.

```md
+++
Expand All @@ -183,6 +184,17 @@ notaxonomy = ["series","authors"]

In the example above the post does only show the "tags" below the content.

### Display for author/writer

The author/writer can now be displayed on the content page. To activate the
function, the option `listAuthor` must be set to `true` in the config.

If you consider to give a link to the author, just use the new front matter
`authorlink`. This option creates a link on the author name to the selected
website.

All content that has no author set, will not use this feature obviously.

## Credits

* [hugo-ink](https://github.com/knadh/hugo-ink) from which Vitae was forked
Expand Down
3 changes: 3 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@

- id: commentsdisqus
translation: "comments powered by"

- id: authorpretext
translation: "Written by"
11 changes: 11 additions & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
{{ partial "head.html" . }}

<div class="post">
<div class="author">
{{ if eq .Site.Params.listAuthor true}}
{{ if isset .Params "author" }}
{{ if isset .Params "authorlink" }}
{{ i18n "authorpretext" }} <a href="{{ .Params.authorlink }}">{{ .Params.author }}</a>
{{ else }}
{{ i18n "authorpretext" }} {{ .Params.author }}
{{ end }}
{{ end }}
{{ end }}
</div>
<div class="post-header">
{{ if ne .Date.Year 1 }}
<div class="meta">
Expand Down
9 changes: 7 additions & 2 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,18 @@ ul {
.termsfloating_right {
float: right;
width: 80%;
border-top: 1px solid #eee;
}

.taxosfloating_left {
float: left;
width: 20%;
border-top: 1px solid #eee;
}

.author {
font-size: 1.2rem;
font-weight: bold;
text-align: left;
margin-bottom: 10px;
}

@media (max-width: 900px) {
Expand Down

0 comments on commit f244a1a

Please sign in to comment.