Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

custom html before content

  • #2101
    Avatar photo[anonymous]

    Hi,

    Is there a way to add custom HTML before and after content instead of before and after post?

    #2103
    Avatar photo[anonymous]

    You can use the Custom HTML Tool for this (Tools -> Custom HTML).

    See also this post:

    Statistics ?

    #2107
    Avatar photo[anonymous]

    There are two settings in the custom HTML tool- before the post and after the post. I wanted to inject custom HTML just before and just after the content.

    #2109
    Avatar photo[anonymous]

    Hi,

    In this case the only way is using theme overrides: https://getpublii.com/dev/theme-overrides/

    #2114
    Avatar photo[anonymous]

    Which file has the settings for custom html? Cannot I just change ‘before and after post’ settings to ‘before and after content’? Suppose I am adding adsense code and want it to show just before the content or just after, not right below the header.

    #2117
    Avatar photo[anonymous]

    You can’t use any these locations:

    <html>
        <head>
        </head>
    
        <body>
    
      {!-- Insert some custom code by Custom HTML tool --}}
      {{{@bodyCustomCode}}}
    
      
    <main class="main"> {{#if @customHTML.beforePost}} {{/if}} {{#if @customHTML.afterPost}} {{/if}} </main>
    {{!-- Insert some custom code by Custom HTML tool --}} {{{@footerCustomCode}}} </body> </html>

    If not, don’t forget that you have full control over your theme!

    All the code is there and you can add whatever you want (see the developers documentation).