Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete UG layouts/sitemap.xml #1898

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

chalin
Copy link
Collaborator

@chalin chalin commented Mar 15, 2024

@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
Copy link
Collaborator

@fekete-robert fekete-robert left a comment

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
11 checks passed
@chalin chalin deleted the chalin-im-ug-sitemap-fix-2024-03-15 branch March 26, 2024 21:55
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