Improve hugo perf a bit. (#6001)

- Improve efficiency of some lookups and loops.

- Stop generating spurious feed.xml files all over the
hierarchy.
This commit is contained in:
Martin Taillefer 2019-12-05 16:08:10 -08:00 committed by GitHub
parent 6b877c9641
commit 9f353c69a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 23 deletions

View File

@ -32,7 +32,7 @@ disableAliases = true
[outputs]
home = ["HTML", "RSS", "REDIR", "JSON"]
section = ["HTML", "RSS"]
section = ["HTML"]
[outputFormats]
[outputFormats.RSS]

View File

@ -7,4 +7,7 @@ icon: blog
decoration: pill
aliases:
- /blog/posts/index.html
outputs:
- html
- rss
---

View File

@ -5,4 +5,7 @@ linktitle: News
sidebar_multicard: true
icon: bullhorn
decoration: pill
outputs:
- html
- rss
---

View File

@ -3,7 +3,7 @@ title: Announcing Istio 1.5
linktitle: 1.5
subtitle: Major Update
description: Istio 1.5 release announcement.
publishdate: 2020-02-11
publishdate: 2019-12-05
release: 1.5.0
skip_list: true
aliases:

View File

@ -14,27 +14,25 @@
{{- else -}}
{{- $latest_release := "" -}}
{{- if or (eq .Params.period_start "latest_release") (eq $.Params.link "latest_release") -}}
{{- range .Site.Pages -}}
{{- if eq .Page.Params.release .Site.Data.args.full_version -}}
{{- if not .Page.Params.draft -}}
{{- $latest_release = . -}}
{{- end -}}
{{- range where .Site.Pages ".Page.Params.release" .Site.Data.args.full_version -}}
{{- if not .Page.Params.draft -}}
{{- $latest_release = . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{ $periodStart := $now }}
{{- $periodStart := $now -}}
{{- if eq .Params.period_start "latest_release" -}}
{{- $periodStart = $latest_release.PublishDate -}}
{{- else -}}
{{ $periodStart = time .Params.period_start }}
{{- $periodStart = time .Params.period_start -}}
{{- end -}}
{{ $periodEnd := $periodStart }}
{{- $periodEnd := $periodStart -}}
{{- if .Params.period_duration -}}
{{- $periodEnd = $periodStart.AddDate 0 0 .Params.period_duration -}}
{{- else -}}
{{ $periodEnd = time .Params.period_end }}
{{- $periodEnd = time .Params.period_end -}}
{{- end -}}
{{- if lt $now $periodEnd -}}

View File

@ -24,7 +24,7 @@
<div id="header-links">
{{ if not .Site.Data.args.archive_landing }}
{{ with (.Site.GetPage "section" "docs") }}
{{ with (.Site.GetPage "/docs") }}
{{ if eq .Permalink $current.Permalink }}
<span {{ if eq $section "docs" }}class="current" {{ end }}title="{{ .Description }}">{{ .LinkTitle }}</span>
{{ else }}
@ -32,7 +32,7 @@
{{ end }}
{{ end }}
{{ with (.Site.GetPage "section" "blog") }}
{{ with (.Site.GetPage "/blog") }}
{{ $posts := (where .Site.Pages "Section" "blog").ByPublishDate.Reverse }}
{{ $latest_post := index $posts 0 }}
{{ $link := printf "%v%v/" .Permalink $latest_post.PublishDate.Year }}
@ -44,7 +44,7 @@
{{ end }}
{{ end }}
{{ with (.Site.GetPage "section" "news") }}
{{ with (.Site.GetPage "/news") }}
{{ if eq .Permalink $current.Permalink }}
<span {{ if eq $section "news" }}class="current" {{ end }}title="{{ .Description }}">{{ .LinkTitle }}<i class="dot" data-prefix="/news"></i></span>
{{ else }}
@ -52,7 +52,7 @@
{{ end }}
{{ end }}
{{ with (.Site.GetPage "section" "faq") }}
{{ with (.Site.GetPage "/faq") }}
{{ if eq .Permalink $current.Permalink }}
<span {{ if eq $section "faq" }}class="current" {{ end }}title="{{ .Description }}">{{ .LinkTitle }}</span>
{{ else }}
@ -60,7 +60,7 @@
{{ end }}
{{ end }}
{{ with (.Site.GetPage "section" "about") }}
{{ with (.Site.GetPage "/about") }}
{{ if eq .Permalink $current.Permalink }}
<span {{ if eq $section "about" }}class="current" {{ end }}title="{{ .Description }}">{{ .LinkTitle }}</span>
{{ else }}

View File

@ -7,7 +7,7 @@
{{- $gloss_entry = .Get 0 -}}
{{- end -}}
{{- $glossary := .Site.GetPage "section" "glossary" -}}
{{- $glossary := .Site.GetPage "/docs/reference/glossary" -}}
{{- $words := $glossary.Resources.ByType "page" -}}
{{- $dfn := "" -}}
{{- $title := $term -}}

View File

@ -69,12 +69,9 @@
{{ $upgrade_notes := .Page.GetPage "./upgrade-notes" }}
{{ if not $upgrade_notes }}
{{ $base_version := printf "%v.%v.0" $page_version $page_revision }}
{{ range $page := .Site.Pages }}
{{ $release := $page.Params.release }}
{{ if eq $release $base_version }}
{{ $path := printf "/%supgrade-notes" $page.File.Dir }}
{{ $upgrade_notes = .Page.GetPage $path }}
{{ end }}
{{ range $page := where .Site.Pages ".Params.release" $base_version }}
{{ $path := printf "/%supgrade-notes" $page.File.Dir }}
{{ $upgrade_notes = .Page.GetPage $path }}
{{ end }}
{{ end }}