Sign in

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

  • This topic has 2 replies, 2 voices, and was last updated 1 month, 3 weeks ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6586
    konstantin

    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
    Bob

    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/

     

     

    --
    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!

    #6590
    konstantin

    That seems to work! Thank you very much 😊

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘THEME SQUARE: Keeping the hero text but having selected post on front page’ is closed to new replies.