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] [outputs]
home = ["HTML", "RSS", "REDIR", "JSON"] home = ["HTML", "RSS", "REDIR", "JSON"]
section = ["HTML", "RSS"] section = ["HTML"]
[outputFormats] [outputFormats]
[outputFormats.RSS] [outputFormats.RSS]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,14 +69,11 @@
{{ $upgrade_notes := .Page.GetPage "./upgrade-notes" }} {{ $upgrade_notes := .Page.GetPage "./upgrade-notes" }}
{{ if not $upgrade_notes }} {{ if not $upgrade_notes }}
{{ $base_version := printf "%v.%v.0" $page_version $page_revision }} {{ $base_version := printf "%v.%v.0" $page_version $page_revision }}
{{ range $page := .Site.Pages }} {{ range $page := where .Site.Pages ".Params.release" $base_version }}
{{ $release := $page.Params.release }}
{{ if eq $release $base_version }}
{{ $path := printf "/%supgrade-notes" $page.File.Dir }} {{ $path := printf "/%supgrade-notes" $page.File.Dir }}
{{ $upgrade_notes = .Page.GetPage $path }} {{ $upgrade_notes = .Page.GetPage $path }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ if $upgrade_notes }} {{ if $upgrade_notes }}
<a class="entry" href="{{ $upgrade_notes.Permalink }}"> <a class="entry" href="{{ $upgrade_notes.Permalink }}">