Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{ghost_head}} doesn't recognize custom rss feed for the route I am on #19615

Closed
1 task done
danielraffel opened this issue Jan 29, 2024 · 2 comments
Closed
1 task done
Labels
support request [triage] A support request that belongs on the forum https://forum.ghost.org/c/help

Comments

@danielraffel
Copy link

Issue Summary

I'm encountering a problem with {{ghost_head}} not recognizing custom RSS feeds for the route I'm on. Here's a link to my forum post for more context: Configuring Custom RSS Feeds when Using a Custom Page.

At a high level, my intentions are:

  1. To have my blog posts appear on my top-level domain, danielraffel.me, without showing any of the posts tagged as links.
  2. I want to host a custom page at /links/ that specifically renders posts tagged as links.
  3. Most importantly, and this is where I'm encountering issues, I want each of these pages to have their own custom RSS feeds, linked in the site metadata using ghost_head.

First, the good news: I've managed to get both RSS feeds working using filters. The feeds at http://danielraffel.me/rss and http://danielraffel.me/links/rss are correctly displaying content as defined in my routes.yaml.

Now, the issue I'm facing: The {{ghost_head}} element is generating metadata that links to a generic RSS feed on every page of my website. For instance, in routes.yaml, this corresponds to the home/rss template. I'm struggling to figure out how to modify ghost_head or the default.hbs file to ensure that the page at http://danielraffel.me/links/ has metadata directing to its specific RSS feed at http://danielraffel.me/links/rss, as defined under the links/rss template in routes.yaml. It seems ghost_head defaults to using the home/rss everywhere, and I can't find a way to override this on the links page.

What works: Visiting the main URL, http://danielraffel.me, and adding it to a feed reader correctly redirects to http://danielraffel.me/rss, thanks to the {{ghost_head}} tag and the home/rss template in routes.yaml.

What doesn’t work: When accessing http://danielraffel.me/links and using this URL in a feed reader, it incorrectly redirects to http://danielraffel.me/rss. This is because the {{ghost_head}} tag, in conjunction with the home/rss template in routes.yaml, generates the same link tag as the main page. Ideally, it should be using the links/rss template specified in routes.yaml for this URL.

I'm stumped on how to get ghost_head to recognize the custom RSS feed for the route I'm currently on.

Here's the relevant section of my routes.yaml file for reference:

routes:
  /links/rss/:
    template: links/rss
    content_type: text/xml

  /rss/:
    template: home/rss
    content_type: text/xml

collections:
  /:
    permalink: /{year}/{month}/{day}/{slug}/
    template: index
    filter: primary_tag:-links

  /links/:
    permalink: /links/{year}/{month}/{day}/{slug}/
    template: links
    filter: primary_tag:links
    data: tag.links

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

Steps to Reproduce

To replicate the issue I'm facing, here are the steps I took:

  1. I created a links.hbs page specifically designed to show only posts tagged with links.
  2. In my routes.yaml, I set up two collections to manage how posts are displayed:
    a) I configured the root path / with a filter to exclude any posts tagged as links.
    b) I then set up /links/ to only display posts with the links tag.
  3. I created two separate RSS feeds: one at /rss/ for my main content and the other at /links/rss for my links content. I made sure to include links to these feeds in my routes.yaml.
  4. After restarting Ghost, I did two checks:
    a) Using a feed reader, I confirmed that accessing domain.com/rss displayed content from my main blog, while domain.com/links/rss showed the content tagged as links.
    b) However, when I checked the rendered HTML of both domain.com and domain.com/links, I found an issue. Both pages linked to domain.com/rss in their metadata.

What I expected in step 4b was that domain.com would link to domain.com/rss and domain.com/links would link to domain.com/links/rss, reflecting their respective content. However, it appears that the ghost_head helper is not recognizing the distinction between these two unique RSS feeds, leading to this unexpected behavior.

Ghost Version

5.77.0

Node.js Version

18

How did you install Ghost?

npm install ghost-cli@latest -g on ubuntu 22.04

Database type

MySQL 8

Browser & OS version

Safari 17 and macOS Sonoma 14.3

Relevant log / error output

No response

Code of Conduct

  • I agree to be friendly and polite to people in this repository
@github-actions github-actions bot added the needs:triage [triage] this needs to be triaged by the Ghost team label Jan 29, 2024
@danielraffel danielraffel changed the title {{ghost_head}} doesn't recognize custom rss feed for the route you’re on {{ghost_head}} doesn't recognize custom rss feed for the route I am on Jan 29, 2024
@daniellockyer daniellockyer added the support request [triage] A support request that belongs on the forum https://forum.ghost.org/c/help label Feb 13, 2024
@github-actions github-actions bot removed the needs:triage [triage] this needs to be triaged by the Ghost team label Feb 13, 2024
Copy link
Contributor

Hey @danielraffel 👋 We ask that you please do not use GitHub for help or support 😄. We use GitHub solely for bug-tracking and community-driven development.

Many questions can be answered by reviewing our documentation. If you can't find an answer then our forum is a great place to get community support, plus it helps create a central location for searching problems/solutions.

FYI: Many projects use issue templates to point you in the right direction. Reading the guidelines or issue templates before opening issues can save you and project maintainers valuable time.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
@danielraffel
Copy link
Author

Actually, this could be seen either as a bug or as a feature request, depending on one's perspective. {{ghost_head}} fails to acknowledge the custom RSS feed for the route. Although I've come across a temporary solution, I believe it's worth re-examining if the root problem was completely grasped (it's excellent if it was and this is the intended solution; otherwise, I'm open to addressing any follow-up questions). I think a fix would be beneficial to others as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support request [triage] A support request that belongs on the forum https://forum.ghost.org/c/help
Projects
None yet
Development

No branches or pull requests

2 participants