Exemplo n.º 1
0
        public void BuildContent(SiteContext ctx)
        {
            BuildConfigurationArk config = ctx.GetConfiguration <BuildConfigurationArk>();

            // Acquire a sitemap exclusion token (temporary state
            // lock) if mod is unlisted from search engines.
            SitemapLocalExclusion?sitemapLock = null;

            if (Info.ExcludeFromSitemaps)
            {
                sitemapLock = ctx.OverrideSitemaps(false);
            }

            using (ctx.TryAddTemplateIncludeNamespace("ARKMods", "templates/Mods"))
                using (ctx.TryAddTemplateDefaultIncludePaths(new []
                {
                    "templates/mods",
                    Path.Join("templates/mods", ModTag),
                }))
                {
                    var updates  = _dataManager.FindModRevisionsByTag(ModTag, RevisionTag.ModUpdate);
                    var homePage = new ModHomeGenerator(Info);

                    ctx.EmitDocument(homePage);
                    BuildInteractiveMaps(ctx);

                    if (Info.WithEpicIni && config.GenerateInis)
                    {
                        var egs = new EpicIniGenerator(Info, updates.Last().Item2);
                        ctx.EmitDocument(egs);
                    }
                }

            // Release the sitemap lock if one was acquired.
            sitemapLock?.Dispose();
        }