Skip to content

Delete UG layouts/sitemap.xml#1898

Merged
chalin merged 2 commits into
google:mainfrom
chalin:chalin-im-ug-sitemap-fix-2024-03-15
Mar 26, 2024
Merged

Delete UG layouts/sitemap.xml#1898
chalin merged 2 commits into
google:mainfrom
chalin:chalin-im-ug-sitemap-fix-2024-03-15

Conversation

@chalin

@chalin chalin commented Mar 15, 2024

Copy link
Copy Markdown
Collaborator

@LisaFC et al.: this is the diff between the UG's custom layouts/sitemap.xml and the Hugo sitemap.xml embedded template (green is the new code):

@@ -1,22 +1,24 @@
-{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
+{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
   xmlns:xhtml="http://www.w3.org/1999/xhtml">
   {{ range .Data.Pages }}
+    {{- if .Permalink -}}
   <url>
-    <loc>https://www.docsy.dev{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
+    <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
     <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
     <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
     <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
     <xhtml:link
                 rel="alternate"
-                hreflang="{{ .Lang }}"
+                hreflang="{{ .Language.LanguageCode }}"
                 href="{{ .Permalink }}"
                 />{{ end }}
     <xhtml:link
                 rel="alternate"
-                hreflang="{{ .Lang }}"
+                hreflang="{{ .Language.LanguageCode }}"
                 href="{{ .Permalink }}"
                 />{{ end }}
   </url>
+    {{- end -}}
   {{ end }}
-</urlset>
+</urlset>
\ No newline at end of file

I see no reason for the UG to have a custom sitemap layout, so this PR drops it.

(Thankfully, this isn't a Docsy bug!)

/cc @jmichelgarcia

@chalin chalin added the user guide Improvements to user guide label Mar 15, 2024

@fekete-robert fekete-robert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chalin chalin merged commit d2ba493 into google:main Mar 26, 2024
@chalin chalin deleted the chalin-im-ug-sitemap-fix-2024-03-15 branch March 26, 2024 21:55
@chalin chalin added this to the 24Q1 milestone Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

user guide Improvements to user guide

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sitemap malformed in www.docsy.dev

2 participants