Sign in

custom html before content

  • This topic has 5 replies, 3 voices, and was last updated 3 years, 6 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #2101
    Avatar photo[anonymous]


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

    Avatar photoVerhoeckx

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


    See also this post:

    Statistics ?


    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.

    Avatar photoTomasz Dziuda


    In this case the only way is using theme overrides:

    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    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.

    Avatar photoVerhoeckx

    You can’t use any these locations:


      {!-- Insert some custom code by Custom HTML tool --}}
    <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).


Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.