phpphp7
جمعه 12 آذر 1395, 19:27 عصر
سلام
یک اکشنی هست به صورت زیر :
public ContentResult Sitemap()
{
XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9";
var items = (from a in db.Tbl_News
select a).ToList();
var sitemap = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
new XElement(ns + "urlset",
from item in items
select
new XElement("url",
new XElement("loc", "localhost:61150" + "/Home/news/" + item.ID),
new XElement("changefreq", "monthly"),
new XElement("priority", "0.9")
)
)
);
return Content(sitemap.ToString(), "text/xml");
}
میخواهم در همین متغیر Site map ، یک نوع دیگر از XDeclaration بسازم .
باید چیکار کرد ؟
سپاس
یک اکشنی هست به صورت زیر :
public ContentResult Sitemap()
{
XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9";
var items = (from a in db.Tbl_News
select a).ToList();
var sitemap = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
new XElement(ns + "urlset",
from item in items
select
new XElement("url",
new XElement("loc", "localhost:61150" + "/Home/news/" + item.ID),
new XElement("changefreq", "monthly"),
new XElement("priority", "0.9")
)
)
);
return Content(sitemap.ToString(), "text/xml");
}
میخواهم در همین متغیر Site map ، یک نوع دیگر از XDeclaration بسازم .
باید چیکار کرد ؟
سپاس