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.

Clarification on adding a post style

  • #2945
    Avatar photo[anonymous]

    I started to being conformable to override theme

    and injecting custom CSS/JS/HTML codes directly in ./input/config/

    but I didn’t succeed to add a new post style as described here https://getpublii.com/dev/how-to-create-custom-templates/#js-header

    I add this in config.json file of my simple-override folder

    },
    "postTemplates": {
    "services": "Human readable template name"
    }

    and simply copy post.hbs from the simple folder to simple-override/post-services.hbs

    so now when I write a new post I see the Other options and Post Template
    but the dropdown menu is gray and say Not available in your theme.
    #3007
    Avatar photo[anonymous]

    Hi,

    It seems that config.json override is not supported :/ I will add it in v.0.37 release which will be focused on the theme development improvements.

    #4557
    Avatar photo[anonymous]

    I generally tried to just add a new post template without overrides, following same tutorial
    https://getpublii.com/dev/how-to-create-custom-templates/#js-header

    But also just see a grayed out dropdown.

    I added a post-services.hbs file (it just just a copy of post.hbs with changed name)

    Publii/app/default-files/default-themes/simple/post-services.hbs

    And then I have edited

    Publii/app/default-files/default-themes/simple/config.json

    and added

    "postTemplates": {
         "services": "Human readable template name"
    },

    but with not success.. another try was to add this code also to

    Publii/app/default-files/theme-files/config.json

    but no success either.

    Am I missing something?

    #4558
    Avatar photoBob

    Publii/app/default-files/default-themes/simple/post-services.hbs – it’s wrong file location.

    You should work in this area: Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME

    #4560
    Avatar photo[anonymous]

    Hmm.. I tried it and still no success… or at least partially..
    I found out one thing – when I run Publi over npm run dev and then npm run build the options are there. But if I used a precompiled application the options are not visible… Might it be it has something to do with caching?

    #4561
    Avatar photoBob

    By default, both versions use the same site files. Are you sure you have made changes to both files in this location: Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME ?

    If yes, please attach your website backup here (Private Reply).

    #4562
    Avatar photo[anonymous]
    This reply has been marked as private.
    #4564
    Avatar photoBob
    This reply has been marked as private.
    #4574
    Avatar photo[anonymous]

    Answer is not visible 🙁

    #4575
    Avatar photoBob

    Something is wrong with your site, many files are missing, after importing to Publi it doesn’t work. It will take some time to figure out why and what is happening, so I really don’t have time for that. Send me the mentioned by you in the previous message input folder instead of a corrupted backup.

    #4576
    Avatar photo[anonymous]

    I just checked and have set setting in App Settings ▸  Files Location ▸  Sites Location back to default.
    With this done, everything works as expected.

    It looks like there is something wrong when having the sites in different location. I will investigate a bit more in the code today and keep You updated Bob.

    #4584
    Avatar photo[anonymous]

    Found out the reason, I edited the
    Documents ▸ Publii configapp-config.json manually (reason for that was a broken app (path I wanted to change to was somehow wrong initially and Publii was crashing).

    The fact that it was a manual change is causing Publii to not run a lot of important file operations.
    I have re-saved the path from Publii directly and my settings as well as as filesystem is fixed now.

    And adding template files works as well now!

    #4585
    Avatar photoBob

    Good news.