How to get metadata from collection


I have a simple custom selection setup to allow me to use a custom home page, and have all the posts on a separate blog page on my site:
I’m trying to get SEO friendly meta title and description for the page and I’ve followed the directions here, but the title still shows up as “Site Name (Page 1).” I’ve seen past cases of this in the forum, and tried some workarounds that didn’t work. The docs make it seem as if it should be a matter of updating the routes file with correct pointer to data. Below is what I have in routes.yaml. Any idea what I’m doing wrong?

  /: home

    permalink: /{slug}/
    template: index

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

Hi there!
I was able to achieve what you’re looking for using the routes like so:

    data: page.home
    template: home

    permalink: /blog/{slug}/
    template: index

It could be because you aren’t specifying a data source for your home route it’s still defaulting to the blog index and that’s why you’re title is showing up like that? I’m not certain. I hope you can use my setup to get what you’re looking for!

Thanks for the suggestion! My home route is actually working fine, and I’m able to get the metadata I want.
What I’m having trouble with is getting data for the blog route: /blog from a tag

Ah I totally misunderstood what you were having trouble with. I see the issue now locally too.

So I’m not sure about the theme you’re using but the casper theme has a default.hbs file that at the top has the handlebars helper {{meta_title}} which is setting your title. Presumably a collection’s default meta_title must be that format with (page 1). I think the idea with those directions is that you wouldn’t use default.hbs you’d use the new template you’ve set and then you can alter the meta_title there.

It’d be better I think if collections just grabbed the meta_title from the tag you’re grabbing, but that doesn’t seem to be the case.