taikii / whiteplain

Simple and Functional Hugo theme.
https://themes.gohugo.io/whiteplain/
MIT License
135 stars 43 forks source link

Add support for a "tagline" attribute displayed in the page header #17

Open krader1961 opened 6 years ago

krader1961 commented 6 years ago

I really like the clean, simple, elegance of the "whiteplain" theme. But there is one feature I wish it supported. An optional site "tagline" displayed below the title and navigation line in the page header. Such as is done by the Kiera theme (which seems to be no longer maintained and doesn't work with the current Hugo version).

See https://www.skepticism.us/ for an example where I've added the tagline "Musings on atheism, software, technology, and movies." I did that by adding the following to my config.toml:

[params]
    tagline = "Musings on atheism, software, technology, and movies."

And modifying layouts/partials/header.html thusly:

diff whiteplain/layouts/partials/header.html whiteplain2/layouts/partials/header.html
10a11,13
>   {{- if .Site.Params.tagline }}
>   <h3>{{ .Site.Params.tagline }}</h3>
>   {{- end }}
12c15
< <hr class="site-header-bottom">
\ No newline at end of file
---
> <hr class="site-header-bottom">

I tried HTML tag <h2> but felt there was insufficient contrast with the blog title. It may be preferable to use another tag and possibly a CSS class but for my purposes using <h3> is good enough aesthetically.

krader1961 commented 6 years ago

I'm happy to create a pull-request but the change is trivial and I don't really care if I get attribution for the enhancement.

krader1961 commented 6 years ago

There is also some anti-DRY (do not repeat yourself) aspects of this theme. For example, the default RSS template uses information from the [author] section that this template seems to require in the [params.author] section. See https://gohugo.io/templates/rss/. It would be good to coalesce around a common convention for such information. In this case I think the theme should use .Site.Author.name, etc.

taikii commented 5 years ago

Thank you for your contribution!

I'd like to add tagline after considering the default style.

I did not notice [author] because it was not mentioned in the Configuration setting... Thank you for pointing out. So, I will change this theme to reference both .Site.Author and.Site.Params.author for the time being.