feat(sitemap): improve priority (#392)

Co-authored-by: Dillon <dillonzq@outlook.com>
This commit is contained in:
Andrea Carratta 2020-05-29 05:09:06 +02:00 committed by GitHub
parent 7b954a46e4
commit 2242e0c3c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,11 +17,17 @@
{{- . -}} {{- . -}}
</changefreq> </changefreq>
{{- end -}} {{- end -}}
{{- if ge .Sitemap.Priority 0.0 -}} {{- if ge .Sitemap.Priority 0.0 -}}
<priority> {{- $weeks := div (sub now.Unix .Lastmod.Unix) 604800 -}}
{{- .Sitemap.Priority -}} {{- $priority := sub 1 (div $weeks 10.0 ) -}}
</priority> {{- if ge .Sitemap.Priority $priority -}}
<priority>{{ .Sitemap.Priority }}</priority>
{{- else -}}
<priority>{{ $priority }}</priority>
{{- end -}}
{{- end -}} {{- end -}}
{{- if .IsTranslated -}} {{- if .IsTranslated -}}
{{- range .Translations -}} {{- range .Translations -}}
<xhtml:link <xhtml:link