Sign in

custom html before content

  • This topic has 5 replies, 3 voices, and was last updated 3 weeks ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2101
    abhijets01

    Hi,

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

    #2103
    Verhoeckx

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

     

    See also this post:

    Statistics ?

     

    #2107
    abhijets01

    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
    Tomasz DziudaTomasz Dziuda
    Moderator

    Hi,

    In this case the only way is using theme overrides: https://getpublii.com/dev/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!

    #2114
    abhijets01

    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
    Verhoeckx

    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).

     

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