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.

THEME SQUARE: Keeping the hero text but having selected post on front page

  • #6586
    Avatar photo[anonymous]

    Hi!

    I’d like to keep the hero text and have a selected post on front page. Is this possible, and how will I achieve this?

    Right now if I select a post from Theme setting the front page hero text will be replaced with that post topic, date and author.

    I’m using the square theme.

    #6588
    Avatar photoBob

    You have to “mix” two files: index.hbs and /partials/frontpage-post.hbs (‎(Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME)
    Open the index.hbs file and copy the main__left section:

    <div class="main__left">
    
       {{#if @config.custom.uploadHero}}
          <figure class="hero">
             <img
                src="{{@config.custom.uploadHero}}"
                {{#if @config.site.responsiveImages}}
                   {{responsiveImageAttributes @config.custom.uploadHero}}
                {{/if}}
                {{ lazyload "eager" }}
                {{imageDimensions @config.custom.uploadHero}}
                alt="{{@config.custom.uploadHeroAlt}}">
    
             {{#if @config.custom.uploadHeroCaption}}
                <figcaption class="hero__caption">
                   {{@config.custom.uploadHeroCaption}}
                </figcaption>
             {{/if}}
          </figure>
       {{/if}}
    
    <header>
       {{{@config.custom.textHero}}}
    </header>
    </div>

    and paste it in place of the same section in the frontpage-post.hbs file.
    It should work.

    To preserve your custom code and prevent it being overwritten the next time the theme is updated, please ensure that you have created override files; these are, essentially, copies of the existing theme files that are stored separately from the main theme fileshttps://getpublii.com/dev/theme-overrides/

    #6590
    Avatar photo[anonymous]

    That seems to work! Thank you very much 😊