Tutorials

Shared template

It is often convenient to use the same HTML template for True Native and Content Display. This can be achieved using template parameters.

Setup
adk.config()
    .addTemplate('com.advisible.content-display', adk.template.config()
        .url('teaser.html'))

    .addContainer('native-teaser', adk.container.config()
        .provider('adk.placement')
        .params({
            adapters: {
                'com.advisible.content-display': {
                    target: '_blank',
                    templateValues: {
                        external: true,
                    }
                },
            },
        }))

    .apply()
    .init(publisherId)
Template
<a class="native-teaser native-settings" href="%url%">
    <div class="native-teaser__marking">AD {#ifdef external}&bull; EXTERNAL LINK{/ifdef}</div>
    <div class="native-teaser__content">
        <img class="native-teaser__image" alt="" %srcAttrs%>
        <div class="native-teaser__text">
            <div class="native-teaser__headline">%headline%</div>
            <div>
                <span class="native-teaser__advertiser">%advertiser%</span>%lead%
            </div>
        </div>
    </div>
</a>
Result
Result