diff --git a/README.md b/README.md index 86cebe3..2a40ef6 100644 --- a/README.md +++ b/README.md @@ -146,22 +146,23 @@ paginate = 5 # oneHeadingSize = false # Single Page Sites have the links in their navigation menu point to sections on the - # main-single page. If `singlePageSite` is enabled the following will occur: - # - Sections will appear on the homepage corresponding to nav menu items with a url - # beginning with "/#". These sections draw their content from the homepage content - # type directory (content/homepage/.md). + # main-single page. If `singlePageSite` is enabled all nav manu entries will be rendered + # on the homepage as homepage sections unless their identifier appears in the + # `homepageNavEntriesDontRender` parameter, in which they will not appear on the homepage. + # - Nav menu items with a url beginning with "/#" are homepage only sections. These + # sections draw their content from the homepage content type directory + # (content/homepage/.md). # - Nav menu items not beginning with "/#" will be also be rendered as sections on the - # homepage either as paginated lists or also as sections depending on what the url is - # pointing to. - # - Nav menu items with their identifier in the `homepageNavEntriesDontRender` list will - # not be rendered on the homepage. - # The homepage sections will be rendered in the order of the nav menu entries. + # homepage either as paginated lists (like posts), as regular sections, or taxonomy depending on + # what the url is pointing to. + # The homepage sections may not render in the order that you expect. Use the `weight` menu parameter + # on the menu entries to make sure the homepage sections appear in the order you like. # enable the sngle page site mode described above singlePageSite = false # for collections rendered on the hompage, you may want them to be paginated at a different - # (usually smaller) count compared to the actual list pages + # (usually smaller) count compared to the actual list pages. Default is 2 homepagePaginateCount = 2 # If there is a nav menu entry you dont want rendered on the homepage, add the identifier here diff --git a/layouts/_default/index.html b/layouts/_default/index.html index e9c33eb..9908444 100644 --- a/layouts/_default/index.html +++ b/layouts/_default/index.html @@ -22,6 +22,7 @@ {{ range .Site.Menus.main }} {{ if not (in $.Site.Params.homepageNavEntriesDontRender .Identifier) }}
+ {{ $navLinkPage := $.Site.GetPage .URL }} {{ if eq (first 2 .URL) "/#" }}

{{ .Name }}

@@ -30,28 +31,43 @@ {{ partial "section.html" . }} {{ end }}
- {{ else }} + {{ else if in "section term" $navLinkPage.Kind }}

{{ .Name }}

- {{ $thisSectionsPages := where $PageContext.RegularPages "Type" .Identifier }} - {{ if len $thisSectionsPages }} - {{ range first $.Site.Params.homepagePaginateCount $thisSectionsPages.ByDate.Reverse }} - {{ partial "collection.html" . }} - {{ end }} - - {{ else }} - {{ with $.Site.GetPage .URL }} - {{ partial "section.html" . }} - {{ end }} + {{ $paginateCount := default 2 $.Site.Params.homepagePaginateCount }} + {{ range first $paginateCount $navLinkPage.Pages.ByDate.Reverse }} + {{ partial "collection.html" . }} {{ end }} + + {{ else if eq $navLinkPage.Kind "page" }} + {{ partial "section.html" $navLinkPage }} + {{ else if eq $navLinkPage.Kind "taxonomy" }} +

{{ .Name }}

+
+
    + {{ range $key, $value := $navLinkPage.Data.Terms.Alphabetical }} + {{ $name := .Name }} + {{ $count := .Count }} + {{ with $.Site.GetPage (printf "/%s/%s" "tags" $name) }} +
  • + {{ .Name }} ({{ $count }}) +
  • + {{ end }} + {{ end }} +
+
+ {{ else if eq $navLinkPage.Kind "taxonomy" }} +

{{ .Name }}

+ {{ else }} + {{ $navLinkPage.Kind }} is not supported yet. {{ end }}