{% from "seomatic/settings/_includes/macros.twig" import configWarning %}
{% import "_includes/forms" as forms %}
{% import 'codeeditor/codeEditor' as codeEditor %}

<fieldset>
    <div class="flex">
        <div class="flex-grow"></div>
        <a href="{{ seomatic.helper.baseSiteUrl(adsTemplate.path) }}" class="btn livepreviewbtn" rel="noopener"
           target="_blank">{{ 'View ads.txt'|t("seomatic") }}</a>
    </div>

    {% namespace "adsTemplate" %}
        {{ forms.lightswitchField({
            label: "Ads.txt Enabled"|t("seomatic"),
            instructions: "Whether the `ads.txt` template should be rendered"|t("seomatic"),
            id: "include",
            name: "include",
            on: adsTemplate.include,
            warning: false,
            errors: adsTemplate.getErrors("include"),
        }) }}

        {{ codeEditor.textAreaField({
            label: "Ads.txt Template"|t("seomatic"),
            instructions: "The [ads.txt](https://iabtechlab.com/ads-txt/) project is simple: Increase transparency in the programmatic advertising ecosystem. ads.txt stands for Authorized Digital Sellers and is a simple, flexible and secure method that publishers and distributors can use to publicly declare the companies they authorize to sell their digital inventory."|t("seomatic") |raw,
            id: "templateString",
            name: "templateString",
            value: adsTemplate.templateString,
            class: "seomatic-javascript-editor selectize-text hidden",
            warning: false,
            errors: adsTemplate.getErrors("templateString"),
        }, "Twigfield", {}, {wrapperClass: "monaco-editor-background-frame"}) }}
    {% endnamespace %}
</fieldset>
