Skip to content

Commit

Permalink
feat(sitemap): improve priority (#392)
Browse files Browse the repository at this point in the history
Co-authored-by: Dillon <dillonzq@outlook.com>
  • Loading branch information
devandreacarratta and dillonzq authored May 29, 2020
1 parent 7b954a4 commit 2242e0c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions layouts/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@
{{- . -}}
</changefreq>
{{- end -}}

{{- if ge .Sitemap.Priority 0.0 -}}
<priority>
{{- .Sitemap.Priority -}}
</priority>
{{- $weeks := div (sub now.Unix .Lastmod.Unix) 604800 -}}
{{- $priority := sub 1 (div $weeks 10.0 ) -}}
{{- if ge .Sitemap.Priority $priority -}}
<priority>{{ .Sitemap.Priority }}</priority>
{{- else -}}
<priority>{{ $priority }}</priority>
{{- end -}}
{{- end -}}

{{- if .IsTranslated -}}
{{- range .Translations -}}
<xhtml:link
Expand Down

0 comments on commit 2242e0c

Please sign in to comment.