我正在用 Go 構建一個站點地圖生成器。我想生成以下 URL 結構來投訴 Google 站點地圖結構。<url> <loc>https://www.website.nl/nl/over-ons</loc> <xhtml:link rel="alternate" href="https://www.website.nl/nl/over-ons" hreflang="nl"/> <xhtml:link rel="alternate" href="https://www.website.nl/en/about-us" hreflang="en"/> <xhtml:link rel="alternate" href="https://www.website.nl/de/uber-uns" hreflang="de"/> <changefreq>daily</changefreq> <priority>0.7</priority> <lastmod>2020-12-05T03:59:58+01:00</lastmod></url>因此我創建了以下結構:type Url struct { Loc string `xml:"loc"` Link Link `xml:"link"` Changefreq string `xml:"changefreq"` Priority string `xml:"priority"` Lastmod string `xml:"lastmod"`}type Link struct { Rel string `xml:"rel,attr,omitempty"` Href string `xml:"href,attr"` Hreflang string `xml:"hreflang,attr"`}我不知道如何處理鏈接字段。可以對以下問題有所幫助嗎?如何在結構中添加三倍相同的“鏈接”字段?如何命名字段“xhtml:link”,我在名稱中收到錯誤:
- 1 回答
- 0 關注
- 118 瀏覽
添加回答
舉報
0/150
提交
取消