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.

Custom post template

  • #3403
    Avatar photo[anonymous]

    Hello, first, a big thanks to the developers of Publii,
    I am currently discovering the CMS and I already like the whole concept!

    I’m not a developer, don’t blame me if my questions may seem absurd,
    I promise not to abuse 😉

    I want to set up simple navigation on the home page:
    A list of projects, and a list of blog posts, each in a separate section.

    I think I understood that we could simulate the creation of pages by checking “hidden” on the post
    so that it is not listed with the other posts.
    These posts will be used for projects.
    I also created a custom template (project_page) for the projects.

    My question is what is the best way to display/list only the project pages in a separate section on the
    site home page:

    I had thought of something like this:

    {{#each project_page}}



    But without success.

    Thank you for any tips,

    Avatar photoBob

    Hi Constantin,

    The “post templates” should be used to change the layout structure and post options.
    In your situation, you should base on tags and display their list of posts; for example, use the “project” tag  for all your project posts and display these posts within this tag on the front page with {{#getPostsByTags}} helper

    Hope this helps.

    Avatar photo[anonymous]

    Hello Bob,

    thank you for your reply,

    Yes, reading the doc awaiting for a reply, I found this solution that work fine.

    Is it the only way to “filter” this type of content? I was searching for something that allow me to not have to “hard write” the tag.

    Avatar photo[anonymous]

    Ok, I found a solution witch works:

    {{#each posts}}
    {{#checkIf template '===' 'project_page'}}