Skip to content

Commit

Permalink
feat: Added page title switcher (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
gummigroda authored Dec 31, 2021
1 parent 9dd94c2 commit 789876a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,16 @@ portfolioitems:
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).
Expand Down
1 change: 1 addition & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ listDateFormat = "2/1/2006"
# 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
Expand Down
14 changes: 10 additions & 4 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<head>
<title>
{{ .Site.Params.author }}{{ with .Title }}
|
{{ . }}
{{ if (eq .Site.Params.reversepagetitle true) }}
{{ with .Title }}
{{ . }} |

{{ end }}{{ .Site.Params.author }}

{{ end }}
{{ else }}
{{ .Site.Params.author }}{{ with .Title }}
| {{ . }}

{{ end }}

{{ end }}
</title>

<!-- Meta -->
Expand Down

0 comments on commit 789876a

Please sign in to comment.