Beispiel #1
0
        /// <summary>
        /// XMLサイトマップを生成する
        /// </summary>
        public static void GenerateXml()
        {
            try
            {
                using (XmlTextWriter writer = new XmlTextWriter(
                           System.Web.HttpContext.Current.Server.MapPath("/sitemap.xml"), Encoding.UTF8))
                {
                    writer.Formatting = Formatting.Indented;
                    writer.WriteStartDocument();
                    writer.WriteStartElement("urlset");
                    writer.WriteAttributeString("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9");

                    // FIXME: 多言語化
                    var umbrachoHelper = new UmbracoHelper(UmbracoContext.Current);
                    Traverse(writer, umbrachoHelper.ContentSingleAtXPath("//VelstandRoot"));

                    writer.WriteEndElement();

                    writer.Flush();
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, ex.Message, ex);
            }
        }
 private static T GetSingleByDocType <T>(this UmbracoHelper umbracoHelper, string parentDocTypeAlias, string docTypeAlias) where T : IPublishedContent
 {
     return((T)umbracoHelper.ContentSingleAtXPath($"//{parentDocTypeAlias}//{docTypeAlias}"));
 }
Beispiel #3
0
 public static GlobalSettings GlobalSettings(this UmbracoHelper umbraco)
 {
     return(umbraco.ContentSingleAtXPath("//globalSettings") as GlobalSettings);
 }
Beispiel #4
0
 /// <summary>
 /// Returnerer et IPublishedContent objekt af indstillingssiden
 /// </summary>
 /// <param name="helper">UmbracoHelper</param>
 /// <returns></returns>
 public static IPublishedContent SettingsPage(this UmbracoHelper helper)
 {
     return(helper.ContentSingleAtXPath("//SOSU-SiteKontainer"));
 }