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

Karol Kania
05.20.2020 36ee0f5b8d40acbb670ec6a3459ea0759b2b9ef5
Make it possible to add (optional) content to Home page
2 files modified
33 ■■■■■ changed files
exampleSite/content/_index.md 21 ●●●●● patch | view | raw | blame | history
layouts/index.html 12 ●●●●● patch | view | raw | blame | history
exampleSite/content/_index.md
@@ -1,3 +1,24 @@
+++
author = "Hugo Authors"
+++
<!--
This file is left intentionally empty by default to be backward compatible with initial theme setup.
Although the theme has advanced a little bit and it now allows to specify the content on the main page (even if the list of posts/articles is not intended).
This can be:
- with the list of posts/articles (default: `mainSections = ["post"]) or
- without the list of posts/articles (by setting `mainSections = [""]`)
Markdown supported, ie:
```
# Welcome
- Hugo :rocket:
- Hugo theme :rocket:
Don't forget to check the README.md file!
```
-->
layouts/index.html
@@ -1,6 +1,18 @@
{{ define "main" }}
    <div class="post {{ with .Site.Params.doNotLoadAnimations }} . {{ else }} animated fadeInDown {{ end }}">
        <!-- (Optional) Home
            -- on top of `mainSections` content (aka posts) ;
            -- as declared in content/_index.md
            One can set `mainSections = [""]` and have the content/_index.md specified here
        -->
        {{ .Content }}
    </div>
    {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
    {{ range $paginator.Pages }}
        <div class="post {{ with .Site.Params.doNotLoadAnimations }} . {{ else }} animated fadeInDown {{ end }}">
            <div class="post-title">
                <h3><a href="{{ .RelPermalink }}">{{ .Title }}</a>