private static IModuleList GetModules(RedirectsSettings settings) => new ModuleList { new Documents() .FromPipelines(settings.Pipelines), new Execute(ctx => { Redirect redirect = new Redirect() .WithMetaRefreshPages(settings.MetaRefreshRedirects.Invoke <bool>(ctx)); if (settings.NetlifyRedirects.Invoke <bool>(ctx)) { redirect.WithAdditionalOutput("_redirects", redirects => string.Join(Environment.NewLine, redirects.Select(r => $"/{r.Key} {r.Value}"))); } return(redirect); }), new WriteFiles() };
/// <summary> /// Creates the pipeline. /// </summary> /// <param name="name">The name of this pipeline.</param> /// <param name="settings">The settings for the pipeline.</param> public Redirects(string name, RedirectsSettings settings) : base(name, GetModules(settings)) { }