TryGhost / Ghost

Independent technology for modern publishing, memberships, subscriptions and newsletters.
https://ghost.org
MIT License
46.27k stars 10.11k forks source link

Can't hide posts from homepage using routes.yaml #20550

Closed cowchimp closed 23 hours ago

cowchimp commented 4 days ago

Issue Summary

I'm trying to hide posts with specific tags from the homepage of my blog using routes.yaml but they still show up. Thank you.

Steps to Reproduce

  1. Install a fresh ghost install using this docker compose file (there is no ./ghost_content directory. it will be auto-created)
version: '3'
services:
  ghost5:
    image: ghost:5.87.1-alpine
    container_name: ghost-debug
    environment:
      - GHOST_LOGGING=debug
      - NODE_ENV=development
      - url=http://localhost:3001
      - database__client=sqlite3
      - database__connection__filename=/var/lib/ghost/content/data/ghost.db
    volumes:
      - ./ghost_content:/var/lib/ghost/content
    ports:
      - "3001:2368"
  1. Go to http://localhost:3001/ghost/#/setup and complete the setup
  2. Go to http://localhost:3001/ghost/#/settings and click Download current routes
  3. Edit the downloaded routes.yaml file
  4. Add a single line directing to hide posts with tag side from the main collection
routes:

collections:
  /:
    permalink: /{slug}/
    template: index
+    filter: tag:-side

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/
  1. Click "Upload routes file" and upload the edited file. Confirm "Routes uploaded" toast message
  2. Go to http://localhost:3001/ghost/#/posts and confirm you already have one post (the default "Coming soon" post)
  3. Create and publish a new post with the title "Hello World" and a tag side
  4. Go to your blog's homepage

Expected behavior: Only the "Coming soon" post should be shown there since it doesn't have the side tag

Actual behavior Both the "Coming soon" and "Hello World" posts are shown

Ghost Version

5.87.1

Node.js Version

docker

How did you install Ghost?

docker ghost:5.87.1-alpine

Database type

SQLite3

Browser & OS version

No response

Relevant log / error output

[2024-07-06 05:27:02] INFO "GET /ghost/api/admin/settings/routes/yaml/" 200 97ms
[2024-07-06 05:28:58] ERROR This should not happen.

This should not happen.

Error ID:
    a50b8090-3b58-11ef-9dd3-ff3581719daf

Error Code:
    URLSERVICE_RESOURCE_DUPLICATE

----------------------------------------

InternalServerError: This should not happen.
    at Urls.add (/var/lib/ghost/versions/5.87.1/core/server/services/url/Urls.js:47:27)
    at UrlGenerator._try (/var/lib/ghost/versions/5.87.1/core/server/services/url/UrlGenerator.js:178:23)
    at /var/lib/ghost/versions/5.87.1/core/server/services/url/UrlGenerator.js:132:18
    at arrayEach (/var/lib/ghost/versions/5.87.1/node_modules/lodash/lodash.js:530:11)
    at Function.forEach (/var/lib/ghost/versions/5.87.1/node_modules/lodash/lodash.js:9410:14)
    at UrlGenerator._onInit (/var/lib/ghost/versions/5.87.1/core/server/services/url/UrlGenerator.js:131:11)
    at Queue.run (/var/lib/ghost/versions/5.87.1/core/server/services/url/Queue.js:125:17)
    at Queue.run (/var/lib/ghost/versions/5.87.1/core/server/services/url/Queue.js:129:22)
    at Queue.run (/var/lib/ghost/versions/5.87.1/core/server/services/url/Queue.js:129:22)
    at Queue.run (/var/lib/ghost/versions/5.87.1/core/server/services/url/Queue.js:129:22)
    at Queue.start (/var/lib/ghost/versions/5.87.1/core/server/services/url/Queue.js:216:14)
    at Bridge.reloadFrontend (/var/lib/ghost/versions/5.87.1/core/bridge.js:106:26)
    at async RouteSettings.setFromFilePath (/var/lib/ghost/versions/5.87.1/core/server/services/route-settings/RouteSettings.js:109:13)
    at async Object.query (/var/lib/ghost/versions/5.87.1/core/server/api/endpoints/settings.js:158:13)
    at async getResponse (/var/lib/ghost/versions/5.87.1/node_modules/@tryghost/api-framework/lib/pipeline.js:259:34)
    at async ImplWrapper (/var/lib/ghost/versions/5.87.1/node_modules/@tryghost/api-framework/lib/pipeline.js:264:30)

[2024-07-06 05:28:59] INFO Ghost URL Service Ready in 248.916s

Code of Conduct

cowchimp commented 1 day ago

It looks like maybe this is an issue in the source theme specifically - TryGhost/Source#33

9larsons commented 23 hours ago

Yep, this is the source theme - thanks for making that connection. I'm going to close this out and I'll take a look at what we can do in the theme.