diff options
| -rw-r--r-- | .gitattributes | 1 | ||||
| -rw-r--r-- | exampleSite/config/_default/config.yaml | 24 | ||||
| -rw-r--r-- | layouts/_default/list.json | 29 | ||||
| -rw-r--r-- | layouts/index.json | 25 |
4 files changed, 31 insertions, 48 deletions
diff --git a/.gitattributes b/.gitattributes index 58a5e37..a4ff553 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,6 +29,7 @@ CONTRIBUTING.md linguist-detectable=false linguist-documentation=true README.md linguist-detectable=false linguist-documentation=true SECURITY.md linguist-detectable=false linguist-documentation=true +/layouts/index.json linguist-language=HTML /layouts/_default/list.*.* linguist-language=HTML /layouts/_default/home.*.* linguist-language=HTML diff --git a/exampleSite/config/_default/config.yaml b/exampleSite/config/_default/config.yaml index 45fabfd..375ecc2 100644 --- a/exampleSite/config/_default/config.yaml +++ b/exampleSite/config/_default/config.yaml @@ -40,25 +40,11 @@ minify: disableXML: true outputs: - home: - - HTML - - Atom - - FEED - - JSONFEED - - JSON - - MANIFEST - - humanstxt - section: - - HTML - - Atom - - FEED - - JSONFEED - page: - - HTML - taxonomy: - - HTML - term: - - HTML + home: [HTML, Atom, FEED, JSONFEED, JSON, MANIFEST, humanstxt] + section: [HTML, Atom, FEED, JSONFEED] + page: [HTML] + taxonomy: [HTML] + term: [HTML] outputFormats: # For more see: https://validator.w3.org/feed/docs/atom.html#whatIsAtom diff --git a/layouts/_default/list.json b/layouts/_default/list.json deleted file mode 100644 index 5742bb3..0000000 --- a/layouts/_default/list.json +++ /dev/null @@ -1,29 +0,0 @@ -{{- $pctx := . -}} -{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} - -{{- $pages := slice -}} -{{- if $.IsHome -}} - {{- $mainSections := site.Params.mainSections | default (slice "posts") }} - {{- $pages = where $pctx.RegularPages.ByDate.Reverse "Type" "in" $mainSections -}} -{{- else if $.IsSection -}} - {{- $pages = $pctx.RegularPages.ByDate.Reverse -}} -{{- else -}} - {{- $pages = $pctx.Pages -}} -{{- end -}} - -{{- $.Scratch.Add "pagesIndex" slice -}} - -{{- range $index, $page := $pages -}} - {{- if gt (len $page.Content) 0 -}} - {{- $pageData := (dict - "title" $page.Title - "href" $page.Permalink - "tags" (delimit ($page.Params.tags | default slice) " ; ") - "categories" (delimit ($page.Params.categories | default slice) " ; ") - "content" $page.Plain - ) -}} - {{- $.Scratch.Add "pagesIndex" $pageData -}} - {{- end -}} -{{- end -}} - -{{- $.Scratch.Get "pagesIndex" | jsonify -}} diff --git a/layouts/index.json b/layouts/index.json new file mode 100644 index 0000000..05d731f --- /dev/null +++ b/layouts/index.json @@ -0,0 +1,25 @@ +{{- $pages := slice -}} + +{{- $mainSections := site.Params.mainSections | default (slice "posts") }} +{{- $pages = where site.RegularPages.ByDate.Reverse "Type" "in" $mainSections -}} + +{{- $.Scratch.Add "pagesIndex" slice -}} +{{- $.Scratch.Add "urlsAdded" slice -}} + +{{- range $index, $page := $pages -}} + {{- if gt (len $page.Content) 0 -}} + {{- if not (in ($.Scratch.Get "urlsAdded") $page.Permalink) -}} + {{- $pageData := (dict + "title" $page.Title + "href" $page.Permalink + "tags" (delimit ($page.Params.tags | default slice) " ; ") + "categories" (delimit ($page.Params.categories | default slice) " ; ") + "content" $page.Plain + ) -}} + {{- $.Scratch.Add "pagesIndex" $pageData -}} + {{- $.Scratch.Add "urlsAdded" $page.Permalink -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{- $.Scratch.Get "pagesIndex" | jsonify -}} |
