Creating a Page with all blog posts

Hello,

I am running a local installation of Ghost inside Windows using WSL (Debian). How can I add a page in my Ghost installation which will display all of my blog posts/articles? That means:

The Name of the page will be “Articles or Posts” and when I go to that page it will show all of my blog posts. I know how to add page, so I need the code snippet to show all posts/articles on that page.

Any kind of help is appreciated.

Ghost Version: 3.40.5
Platform: WSL (Debian) on Windows 10 build 20H2
Node: 12.10.1

I’m wondering if there’s any update on this?

There’s no snippet that does this.

It depends on the theme, but this can probably be accomplished with routing.

1 Like

It is possible. See Wills, Trusts, Estates: Blog My blog post page is not my landing page.

I’m using a theme I purchased: Newsportal - News and Magazine Ghost Blog Theme

The theme has a file called blog.hbs that has a lot of theme-specific HTML. The relevant for the blog post page uses Handlebars code that starts like this:

{{#get "posts" limit="all"}}
                {{#foreach posts}}

So, you’re getting all of the posts and then you’re looping through them to do something with them. The theme authors created a card for each post.

The routes then has a collection for this page:

collections:
  /blog/:
    permalink: /{slug}/
    template: blog

I think this post is helpful: How to create Post Archive page in your Ghost Theme? – Themeix They’re using routes instead of collections. (I’ve read about the differences between routes and collections but I still haven’t fully wrapped my mind around them.)

I hope this information is useful.

2 Likes

Thank you @hsarji for your reply.

I can add extra solution here.

If you want to add Load more button or pagination, you need to use {{#foreach posts}}{{/foreach}}

{{#foreach posts}}

{{/foreach}}
{{pagination}}