Skip to content

Commit 18c1ace

Browse files
committed
fix: Improve sitemap XML formatting for Google Search Console
- Fixed sitemap template with proper XML formatting - Removed minified XML output for better parsing - Added proper indentation and line breaks - Enhanced sitemap configuration - Should resolve 'Couldn't fetch' error in GSC
1 parent 097ab74 commit 18c1ace

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

portfolio/config.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,11 @@ canonifyURLs = true
3131
[sitemap]
3232
changefreq = "weekly"
3333
priority = 0.5
34+
filename = "sitemap.xml"
35+
36+
# Exclude certain pages from sitemap
37+
[taxonomies]
38+
category = "categories"
39+
tag = "tags"
3440

3541
ignoreLogs = ['warning-goldmark-raw-html']
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
3-
xmlns:xhtml="http://www.w3.org/1999/xhtml">
3+
xmlns:xhtml="http://www.w3.org/1999/xhtml">
44
{{ range .Data.Pages }}
5+
{{ if not .Params.private }}
56
<url>
6-
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
7-
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
8-
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
9-
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
10-
<xhtml:link
11-
rel="alternate"
12-
hreflang="{{ .Language.Lang }}"
13-
href="{{ .Permalink }}"
14-
/>{{ end }}
15-
<xhtml:link
16-
rel="alternate"
17-
hreflang="{{ .Language.Lang }}"
18-
href="{{ .Permalink }}"
19-
/>{{ end }}
7+
<loc>{{ .Permalink }}</loc>
8+
{{ if not .Lastmod.IsZero }}
9+
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>
10+
{{ end }}
11+
{{ with .Sitemap.ChangeFreq }}
12+
<changefreq>{{ . }}</changefreq>
13+
{{ end }}
14+
{{ if ge .Sitemap.Priority 0.0 }}
15+
<priority>{{ .Sitemap.Priority }}</priority>
16+
{{ end }}
2017
</url>
2118
{{ end }}
19+
{{ end }}
2220
</urlset>

0 commit comments

Comments
 (0)