mirror of https://github.com/lxndrblz/anatole.git

Osterberg
31.27.2021 789876a144c58cd4876913ac75c2024c643576a6
feat: Added page title switcher (#286)

3 files modified
23 ■■■■ changed files
README.md 10 ●●●●● patch | view | raw | blame | history
exampleSite/config/_default/params.toml 1 ●●●● patch | view | raw | blame | history
layouts/partials/head.html 12 ●●●● patch | view | raw | blame | history
README.md
@@ -743,6 +743,16 @@
Please note that fields such as start, end, authors, and tags will only appear if they have been populated. The image path defined under `image` parameter is relative to the static folder, similarly to images included in the post.
### Reverse Page Title
By default, the title of pages is `Author | PageTitle`. You can switch the order to `PageTitle | Author` by setting the parameter `reversepagetitle` to `true` in `config.toml`.
```toml
[params]
reversepagetitle = true
```
## License
Anatole is licensed under the [MIT license](https://github.com/lxndrblz/anatole/blob/master/LICENSE).
exampleSite/config/_default/params.toml
@@ -28,6 +28,7 @@
# readMore = true
# postSectionName = "blog"
reversepagetitle = true # When set to 'true', the Window Title will be reversed to 'Title | Author' instead of the default 'Author | Title'
[simpleAnalytics]
# enable = true
layouts/partials/head.html
@@ -1,12 +1,18 @@
<head>
  <title>
    {{ .Site.Params.author }}{{ with .Title }}
      |
      {{ . }}
    {{ if (eq .Site.Params.reversepagetitle true) }}
      {{ with .Title }}
        {{ . }} |
      {{ end }}{{ .Site.Params.author }}
    {{ else }}
      {{ .Site.Params.author }}{{ with .Title }}
        | {{ . }}
    {{ end }}
    {{ end }}
  </title>
  <!-- Meta -->