Hello folks!
This is my first time playing with the collection function. My goal is to filter out some tags from the Ghost’s homepage.
On my Ghost’s homepage the filter works as expected. Cool!
But when I go to my site https://mysite.com/en/tag/about/ and click on a post from there, I’m getting this error ’ 500 Resource not found.’
My ghost version is v2.6.1
I guess something is wrong with my route.yaml
Thanks in advance!
P
routes:
collections:
/:
permalink: /{slug}/
filter: tag:-[how-to,about,under-the-hood]
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
2 Likes
John
November 28, 2018, 4:02am
2
That’s not quite how collections work: Collections define where a post lives. If there is only 1 collection and you filter posts out of it, then those posts don’t live on any route, which == 500 error
It seems like what you’re looking for is a Channel, which is a specific view of content without changing or influencing where it lives, assigned to the home route. Eg:
routes:
/:
controller: channel
filter: tag:-[how-to,about,under-the-hood]
collections:
/archive:
permalink: /{slug}/
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
More info
Thanks for jumping in John. You explanation is very clear and I understand where I messed up.
I’m applying this yaml but no filtering occurs on https://mysite.com/en/
To be clear about my domains:
routes:
/:
# Filters out few tags from Ghost's homepage
controller: channel
filter: tag:-[how-to,about,under-the-hood]
collections:
/:
permalink: /{slug}/
template:
- index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
Thank you!
John
November 28, 2018, 5:38am
4
You’re registering the /
twice, as a route and as a collection, so that’s conflicting. In my example I moved the main collection to /archive
for that reason
I did try did as well (before posting the 3td comment) and I still don’t see any filter applied.
# filters out few tags from Ghost's homepage
routes:
/:
controller: channel
filter: tag:-[how-to,about,under-the-hood]
# redefine the collections as I we can't define /: twice
collections:
/archive/:
permalink: /{slug}/
template:
- index
# default values
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
With Ghost 2.8.0 it’s now fixed:
Solution
# filters out few tags from Ghost's homepage
routes:
/:
controller: channel
filter: tag:-[about,under-the-hood,how-to]
collections:
/:
permalink: /{slug}/
template:
- index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
Little hack
Instead of filtering out , I decided to limit to. I can perfectly live with this :)
# filters out few tags from Ghost's homepage
routes:
/:
controller: channel
filter: tag:[article,proof]
# excluding: [about,under-the-hood,how-to]
# redefine the collections as I we can't define /: twice
collections:
/archive/:
permalink: /{slug}/
template:
- index
# default values
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
Issue open on Github
opened 08:36PM - 01 Dec 18 UTC
closed 09:39PM - 04 Dec 18 UTC
needs info
Hello folks!
I'm following [from this conversation in the forum](https://foru… m.ghost.org/t/collection-filters-works-well-on-the-homepage-but-breaks-under-tags-section/4273/3?u=pascalandy). My goal is to filter out some tags from the Ghost’s homepage.
### EDIT: Little hack
[For now, this works](https://github.com/TryGhost/Ghost/issues/10230#issuecomment-444264911)
### Issue
I’m applying this yaml but no filtering occurs on https://mysite.com/en/
**EDIT**: The result in my case, is that those tags ([how-to, about, under-the-hood]) do still appears in Ghost’s homepage.
To be clear about my domains:
- https://mysite.com/ is served by Caddy (static pages)
- https://mysite.com/en/ is served by Ghost
```
# filters out few tags from Ghost's homepage
routes:
/:
controller: channel
filter: tag:-[how-to,about,under-the-hood]
# redefine the collections as I we can't define /: twice
collections:
/archive/:
permalink: /{slug}/
template:
- index
# default values
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
```
### Technical details:
* Ghost Version: 2.1.1
* CLI version: 1.9.4
* Node Version: 10.14.10
* Browser/OS: chrome 66, osx 10.13.4
* Server-side: Alpine:3.8 in Docker [using this image](https://travis-ci.org/firepress-org/ghostfire/branches)
* Database: sqlite
system
Closed
December 15, 2018, 8:43pm
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.