1
Google은 ContentResult에 의해 생성 된 사이트 맵을 만들었지 만 Google은 내 네임 스페이스가 정확하지 않다고 알려주고 있습니다. 어떤 아이디어?ASP.NET MVC ContentResult의 Google Sitemap - 잘못된 네임 스페이스
내 코드 :
public ContentResult Index()
{
//Build RSS for sitemap
XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9";
const string url = "http://www.openarmssoberliving.com/{0}";
var encoding = Response.ContentEncoding.WebName;
var items = _pagesRepos.Pages.OrderBy(p => p.Id).ToList();
items.Add(new Page { Title = "Contact Us", Slug = "ContactUs", LastModified = items[0].LastModified });
var sitemap = new XDocument(new XDeclaration("1.0", encoding, null),
new XElement(ns + "urlset",
from item in items
select
new XElement(ns + "url",
new XElement(ns + "loc", string.Format(url, (item.Id != 1) ? item.Slug : "")),
new XElement(ns + "lastmod", String.Format("{0:yyyy-MM-dd}", item.LastModified)),
new XElement(ns + "changefreq", "monthly"),
new XElement(ns + "priority", "0.5")
)
)
);
return Content("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + sitemap, "text/xml");
}
출력 : http://www.openarmssoberliving.com/Sitemap
오류 : 2 호선 사이트 맵 또는 사이트 맵 색인 파일에 네임 스페이스가 올바로 명시되어 있지 않습니다.