Skip to content
Permalink
Browse files

postSections -> mainSections

* postSections -> mainSections
* Rewrite no posts empty state text
  • Loading branch information...
Vimux committed Mar 20, 2019
1 parent 4c54117 commit ab9595f9aaf86d6a5c69cee8c96666dda214fe56
Showing with 9 additions and 7 deletions.
  1. +3 −2 README.md
  2. +0 −1 exampleSite/config.toml
  3. +5 −3 layouts/index.html
  4. +1 −1 layouts/partials/widgets/recent.html
@@ -68,8 +68,7 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id
toc = true # Enable Table of Contents
post_navigation = true # Show post navigation at bottom of pages if true
post_meta = ["date", "categories", "translations"] # Order of post meta information
postSections = ["post"] # the section pages to show on home page and the "Recent articles" widget
#postSections = ["blog", "news"] # alternative that shows more than one section's pages
#mainSections = ["post", blog", "news"] # specify section pages to show on home page and the "Recent articles" widget
#dateformat = "2006-01-02" # change the format of dates
#mathjax = true # Enable MathJax
#mathjaxPath = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" # Specify MathJax path
@@ -100,6 +99,8 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id
email = "example@example.com"
```

A good idea is not copy double check all the Configuration settings of Minimo.

### Front Matter example

```yaml
@@ -20,7 +20,6 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id
authorbox = true
post_navigation = true
post_meta = ["date", "categories"] # Order of post meta information
postSections = ["post"]

[Params.sidebar]
home = "right" # Configure layout for home page
@@ -5,16 +5,18 @@
{{ . }}
</div>
{{- end }}
{{- $postSections := ($.Param "postSections" | default (slice "post")) }}
{{- $paginator := .Paginate ( where .Data.Pages "Section" "in" $postSections ) }}
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
{{- range $paginator.Pages }}
{{- .Render "summary" }}
{{- end }}
{{- if eq $paginator.TotalNumberOfElements 0 }}
<div class="warning">
<svg class="warning__icon icon icon-files" viewBox="0 0 384 384" width="96" height="96" fill="#ddd"><path d="m368 64h-224-16v16 288 16h16 224 16v-16-288-16zm-16 288h-192v-256h192zm-320-320h192v16h32v-32-16h-16-224-16v16 288 16h16 96v-32h-80zm144 272h160v-32h-160zm0-64h160v-32h-160zm0-64h160v-32h-160zm-128 64h64v-32h-64zm0-64h64v-32h-64zm0-64h64v-32h-64z"/></svg>
<h3 class="warning__headline">You don't have any posts yet!</h3>
<p class="warning__text">As posts are added in <b>{{ replaceRE ",([^,]*)$" " or $1" (delimit (apply $postSections "printf" "content/%s" ".") ", ") }}</b> folder{{ if gt (len $postSections) 1 }}s{{ end }}, they'll appear here.</p>
<div class="warning__text">
<p class="warning__description">As posts are added in any subfolder in <b>content/</b> folder (<b>content/post</b>, for example), they'll appear here. Only one section with the most pages will be appeared by default.</p>
<p class="warning__tip"><b>Tip:</b> You can set as many sections as you like with <b><a href="https://gohugo.io/functions/where/#mainsections" rel="nofollow noopener" target="_blank">mainSections</a></b> config parameter.</p>
</div>
</div>
{{ end }}
</main>
@@ -1,4 +1,4 @@
{{- $recent := where .Site.RegularPages "Section" "in" (.Site.Params.postSections | default (slice "post")) }}
{{- $recent := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
{{- $recent_num := (.Site.Params.widgets.recent_num | default 10) }}

{{- if $recent }}

0 comments on commit ab9595f

Please sign in to comment.
You can’t perform that action at this time.