Search code examples
lektor

How to show my posts in the first page and not in the "/blog" and maintaining other sub folders working like "/about" and "/projects"


I'm trying to use Lektor as my blog platform, but I am running into a few issues.

Following the guide I can make everything work. My problem begin when I try to make the blog the first page, without the "/blog".

If I query in the page template the blogs children, the pagination don't work.

If I make the blog-post children of the page using "replaced_with = site.query('/blog')" the initial page renders fine, but if I try to access any page, appears a Not Found message.

My goal is show my posts in the first page and have other folders, like "/about" or "/projects" in the root folder.


Solution

  • I get it! The way to do it was setting a query in the "items" key on the page model.

    Like this:

    [model]
    name = Page
    label = {{ this.title }}
    hidden = yes
    protected = yes
    
    [fields.title]
    label = Title
    type = string
    
    [pagination]
    enabled = yes
    per_page = 10
    items = site.query('/blog')
    

    After that it worked like a charm. :)