https://kotlinlang.org logo
#dokka
Title
# dokka
v

Vlad Ostaci

03/30/2023, 11:03 AM
I followed https://kotlinlang.org/docs/dokka-html.html#templates I'm trying to add my own javascript script to every html page but without success.
Copy code
tasks.withType<DokkaTask>().configureEach {
    pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
        templatesDir = file("dokka")
        customStyleSheets = listOf(file("dokka/dokka_custom_styles.css"))
    }
}
My file structure looks like this: module: - dokka - dokka_custom_styles.css - includes - page_metadata.ft The styles are picked up correctly but not the script:
Copy code
<#macro display>
    <title>${pageName}</title>
    <@template_cmd name="pathToRoot">
    <link href="${pathToRoot}images/logo-icon.svg" rel="icon" type="image/svg">
    <script>
        function myCustomFunction() {
            // Some code
        };

        window.addEventListener("DOMContentLoaded", function() {
            myCustomFunction();
        }, false);
    </script>
    </@template_cmd>
</#macro>
1
i

Ignat Beresnev

03/30/2023, 11:06 AM
Hi! Let's have a look
- page_metadata.ft
is it
.ft
or
.ftl
?
v

Vlad Ostaci

03/30/2023, 11:08 AM
i

Ignat Beresnev

03/30/2023, 11:09 AM
oh, sorry, that's a slip up, it should be
.ftl
. Can you try it out?
Just tried it out with
.ftl
- seems to work
v

Vlad Ostaci

03/30/2023, 11:11 AM
Yes, all fixed now.
.ftl
extension works.
Thank you @Ignat Beresnev.
i

Ignat Beresnev

03/30/2023, 11:15 AM
Thanks for noticing and bringing this to our attention! I hope not that many people suffered from it 😞 I've pushed the fix just now, should automatically be deployed to the website some time later today
👍 1
7 Views