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.

Exploring Theme Code – Simple Theme

  • #9546
    Avatar photo[anonymous]

    I am looking at head.hbs in the theme Simple.  There is a couple sections that I am trying to wrap my head around.  Lines 31-45 look like this:

           {{#is "post"}}
               {{#post}}
                  {{#if hasGallery}}
                     <link rel="stylesheet" href="{{css "photoswipe.css" }}">
                  {{/if}}
               {{/post}}
            {{/is}}	
            {{#checkIf @config.custom.frontSource '==' "post" }}
               {{#checkIf @config.custom.frontGallery '==' true}}
                  {{#is "index"}}
                     <link rel="stylesheet" href="{{css "photoswipe.css" }}">
                  {{/is}}
               {{/checkIf}}
            {{/checkIf}}

    I understand that if this is a “post” and it “hasGallery” it will load the photoswipe.css file.

    Why is the next section of code not redundant?  Can the content not be a post but have a custom front font source that equal to post?  How?  I do not see anything in the settings for this theme that would allow me to select the “post” font as a source for the front font.

    What am I missing?

    The same source code does almost the same thing in lines 48-89 (not shown) for loading light and dark icon sets when the Gallery is present.

    Thanks

    #9547
    Avatar photo[anonymous]

    The way I understand this code, using your extract line number references above:

    lines 1 to 7 check if any post has an image gallery, if yes, then the photoswipe.css applies to display the gallery. If not, it’s ignored.

    Lines 8 to 14 probably relates to the front source / front page / home page, whatever you want to call it. The code then checks for any post on the home page (or the home page may just be a single post), if that post has a ‘front gallery’, then likewise, photoswipe.css also determines how the gallery displays.

    I don’t think there are any references to font sources.

    Though, I may be wrong (we’re all striving to learn here aren’t we? 🙂

    #9548
    Avatar photo[anonymous]

    Also, the page at: https://getpublii.com/dev/checkif-helper/ seems to help.