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

Title/Meta Description not working if custom Routes.yaml Collection in my custom template #11418

Closed
Edd-G opened this issue Nov 25, 2019 · 14 comments
Labels
bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with stale [triage] Issues that were closed to to lack of traction

Comments

@Edd-G
Copy link

Edd-G commented Nov 25, 2019

Issue Summary

Title / Meta Description not working for custom Routes.yaml Collection in my custom template.
I see "Blog title (Page 1)" in the post list in custom template.

To Reproduce

Routes.yaml

routes:
  /rss/turbo-page/:
    template: turbo-page
    content_type: text/xml
  /: home

collections:
  /cases/:
    permalink: /cases/{slug}/
    template: cases
    filter: primary_tag:cases
    data: tag.cases
  /blog/:
    permalink: /blog/{slug}/
    template: blog
    filter: primary_tag:blog
    data: tag.blog

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

I see "Blog title (Page 1)" by url: http://site.com/cases/
and http://site.com/blog/
Same in the title and meta tags (twitter&og).
But in the tag admin interface - description, meta description and meta title i set another value.
Image of tags admin

Technical details:

  • Ghost Version: 3.0.3
  • Node Version: v10.16.2
  • Browser/OS: Debian 4.19.67-2+deb10u2
  • Database: MariaDB
@Edd-G Edd-G changed the title Title/Meta Description for tag data not working if custom Routes.yaml Collection in my custom template Title/Meta Description not working if custom Routes.yaml Collection in my custom template Nov 25, 2019
@vikaspotluri123
Copy link
Member

I think this is the same as #10082

@Edd-G
Copy link
Author

Edd-G commented Nov 25, 2019

@vikaspotluri123 maybe you're right. Then why #10082 the status closed?

@naz naz added the needs:info [triage] Blocked on missing information label Nov 26, 2019
@naz
Copy link
Contributor

naz commented Nov 26, 2019

Hey @Edd-G. Did a little spin to it but wasn't able to reproduce. Used the same 'blog' entry in routes.yaml (the template is exact copy of page.hbs):

collections:
  /blog/:
    permalink: /blog/{slug}/
    template: home
    filter: primary_tag:blog
    data: tag.blog

And it worked just fine for me:
Screenshot from 2019-11-26 11-24-05

What theme are you using? I tried it on slightly modified Lyra.

Then why #10082 the status closed?

If the issue is not causing big 'pain' to most of the users we usually leave it for the community itself to pick up 🙂 It wasn't picked up, so after a while got closed due to other priorities.

@Edd-G
Copy link
Author

Edd-G commented Nov 26, 2019

Hi! @gargol
I use https://github.com/eddiesigner/liebling
but i have the same problem with Liebling and Lyra theme.

I tryed use Lyra, did what you described.

  1. Install Lyra
  2. Copy themes/Lyra-master/page.hbs to themes/Lyra-master/blog.hbs
  3. Upload my Routes.yaml
routes:
  /rss/turbo-page/:
    template: turbo-page
    content_type: text/xml
  /: home

collections:
  /cases/:
    permalink: /cases/{slug}/
    template: cases
    filter: primary_tag:cases
    data: tag.cases
  /blog/:
    permalink: /blog/{slug}/
    template: blog
    filter: primary_tag:blog
    data: tag.blog

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

and see blank page, show only header & footer template.
Exact copy of page.hbs don't work.
Works only after small changes. But i still see "Site title (Page 1)" in title url http://mysite/blog/

I also checked the demo site https://lyra.ghost.io/tag/getting-started/
I can’t see the tag <meta name=descruption> there, as you have in the screenshot.

@jeffdaley
Copy link

I'm also getting (Page 1) in the <title> and no meta description.

@naz naz added bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with themes and removed needs:info [triage] Blocked on missing information labels Nov 27, 2019
@naz
Copy link
Contributor

naz commented Nov 27, 2019

@Edd-G & @jeffdaley I see what the problem is now.

For some reason assumed the issue is the same as in linked one where the problem was for pages accessed through routes configuration.

For this instance, the problem is a little different it has to do with collections configuration. Might be related to update to metadata generation we did lately - #11068, specifically this change - https://github.com/TryGhost/Ghost/pull/11068/files#diff-b1da6b1605d94d5819bea1f7adb1f603L6.

Dynamic routing was left from the rules taken into account 😬

Think the correct behavior in this situation should be a following rule for fallback condition:

{settings.meta_title || settings.title} (Page x)

Fyi, @kevinansfield

@kevinansfield
Copy link
Member

@gargol those changes only went out in 3.1.0. I'm a little confused as to what the status of this issue is now, OP is not using the updated meta data rules, are you testing against the updated rules or the old rules?

Dynamic routing was left from the rules taken into account 😬

Which contexts are missing?

@naz
Copy link
Contributor

naz commented Nov 28, 2019

are you testing against the updated rules or the old rules?

Was testing against master - current 3.1.0

Which contexts are missing?

Not a specific context but a "fallback" condition mentioned above - https://github.com/TryGhost/Ghost/blob/master/core/frontend/meta/title.js#L52 is not behaving the same way anymore :)

@kevinansfield
Copy link
Member

kevinansfield commented Nov 28, 2019

The fallback there is irrelevant. The issue is that the tag's meta data (specified with data: tag.blog) is not being used on the collection index page - it should never be hitting the fallback.

In so far as the fallback goes it's now following the intended behaviour as far as I'm aware. The meta data set via the settings screen (this is what it sounds like you are referring to - please correct me if I'm wrong!) is intended for the homepage not as a fallback everywhere.

@naz
Copy link
Contributor

naz commented Dec 2, 2019

The fallback there is irrelevant.

@kevinansfield in the case described in the issue, where your route config contains a collection like such:

  /cases/:
    permalink: /cases/{slug}/
    template: index
    filter: primary_tag:cases
    data: tag.cases

The context which is passed into title helper is ["cases"]. It can be more than one filter that defines the collection, so it wouldn't be correct to put a "tag" context on it. We could put in detection of cases where just one tag defines a collection and add "tag" context to it, but that's not a current expectation I believe.

To hit the "tag" context condition you can access taxonomy tag: /tag/{slug}/ through e.g /tag/green/ which then behaves as you described :)

@stale
Copy link

stale bot commented Mar 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale [triage] Issues that were closed to to lack of traction label Mar 1, 2020
@stale stale bot closed this as completed Mar 8, 2020
@agustinv
Copy link

What is the status of this? and is there a workaround?

@naz
Copy link
Contributor

naz commented Jun 29, 2020

@agustinv there were no updates to this issue and no known workaround. Feel free to pick it up in case you are interested 😉

@danielherndon
Copy link

danielherndon commented Dec 29, 2022

I'm hunting for a solution to this issue. I have found that the issue appears for me when data: tag.cases and order: published_at asc are both used in a routes: configuration.

I want to display a tag and have the routes displayed in ascending order. They are chapters of a book released in order and I would like them to be displayed in Chapter 1, 2, 3, 4, etc. order. But I also want the Tag metadata (Title, Description) to display above. I can get one, or the other, but not both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with stale [triage] Issues that were closed to to lack of traction
Projects
None yet
Development

No branches or pull requests

7 participants