diff options
author | Andrea Carratta <46504271+devandreacarratta@users.noreply.github.com> | 2020-05-29 06:09:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-29 06:09:06 +0300 |
commit | 2242e0c3c74a95afb5f11f366977ce1d9a0b16ba (patch) | |
tree | d235f0ac7ba64b311eee3e8799385603c6b4aaa0 /layouts/sitemap.xml | |
parent | 7b954a46e47749caf52dee9a472c95cb63eddd31 (diff) |
feat(sitemap): improve priority (#392)
Co-authored-by: Dillon <dillonzq@outlook.com>
Diffstat (limited to 'layouts/sitemap.xml')
-rw-r--r-- | layouts/sitemap.xml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml index d13d928..f931c44 100644 --- a/layouts/sitemap.xml +++ b/layouts/sitemap.xml @@ -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 |