Homepage Filter

Hello,
We chatted with the Ghost support team all day. We haven’t solved it yet.
My website is full public. It isn’t using a subscription model.

Ghost Pro
Ghost 4.0

I would like to filter the posts to be shown on the homepage.
I added 4 posts by #main-page tag.
This time, no one came. Empty page.

For example; Posts with the tag:main-page information should show on the homepage.

In default.hbs file filter info I changed but not working.

filter=“visibility:internal”. > filter=“tag:main-page”

Please, can you help me?

#route.yaml

routes:
  /signup/: members/signup
  /signin/: members/signin

collections:
  /blog/:
    permalink: /blog/{slug}/
    template: index
  /:
    permalink: /{slug}/
    template: index
    filter:tag: hash-main-page

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/


#index.hbs

{{!< default}}
{{#is "home"}}
{{>slider}}
{{/is}}
{{>loop}}
{{>load_more}}
{{pagination}}



#default.hbs

<!DOCTYPE html>
<html lang="{{@site.locale}}">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>{{meta_title page=(t "meta-page")}}</title>
		<meta name="HandheldFriendly" content="True">
		<meta name="MobileOptimized" content="320">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		{{>services/google_fonts}}
		<link rel="stylesheet" type="text/css" href="{{asset "css/screen.css"}}">
		{{ghost_head}}
	</head>
	<body class="{{body_class}}{{#get "tags" limit="all" filter="tag:main-page"}}
	{{#foreach tags visibility="internal"}} global-{{slug}}{{/foreach}}{{/get}}">
		<div class="global-wrap">
			<div class="section-content-wrap">
				{{>header}}
				{{{body}}}
				{{#is "index, author, tag"}}
				{{>members/subscribe_form}}
				{{/is}}
			</div>
			{{>footer}}
		</div>
		{{>members/notifications}}
		{{>search}}
		{{#if pagination.pages}}
		<script>var numberPage = {{pagination.pages}};</script>
		<script src="{{asset "js/index.js"}}"></script>
		{{/if}}
		{{#is "post, page"}}
		<script src="{{asset "js/post.js"}}"></script>
		{{/is}}
		<script src="{{asset "js/global.js"}}"></script>
		<script src="{{asset "js/ityped.js"}}"></script>
		{{{block "members_subscribe_form_script"}}}
		{{{block "notifications_script"}}}
		{{ghost_foot}}
	</body>
</html>

Your /blog/ collection doesn’t have a filter which means all posts will belong to it. The order of your collections matters!

Thank @vikaspotluri123, so much.
Solved it simply. Blog > /tag/blog.

I would like to filter only for posts to be shown on the homepage.

I guess. I will make it with code.
Has “home” and “tag” info accessible in the hbs file?

All posts on the homepage shown.

collections:
  /:
    permalink: /{slug}/
    template: index
    filter:tag: hash-main-page

The homepage is empty.

routes:
  /signup/: members/signup
  /signin/: members/signin
collections:
  /blog/:
    permalink: /blog/{slug}/
    template: index
    filter:tag: blog
  /:
    permalink: /{slug}/
    template: index
    filter:tag: hash-main-page
taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

All posts on the homepage shown.

routes:
  /signup/: members/signup
  /signin/: members/signin
collections:
  /:
    permalink: /{slug}/
    template: index
    filter:tag: hash-main-page
  /blog/:
    permalink: /blog/{slug}/
    template: index
    filter:tag: blog
taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

I solved with code.

{{#is "home"}}
        {{#has tag="#main-page"}}
         home page posts
        {{/has}}
{{else}}
other page posts
{{\is}}
1 Like