How to set node title as Views name?

Created on 16 November 2021, almost 3 years ago
Updated 19 April 2023, over 1 year ago

Problem/Motivation

I've created a View page with Similar by terms: Nid as context filter.
Page url is node/%/similar.

Everything works great, but I can't get one thing.

I want to change the Views name and page title to something like "Similar to [node_title]". This is very, very important for SEO.

But under the "Override title" section I can set only numeric node ID, which is provided by replacement patterns, I can't set proper title there.

So I created a new context filter, which is simple Content: ID. So there are two filters now and this is where the real problem starts.
I can't get them to work together. They work fine one by one, but not together. Don't know why.

Either view shows me 404, or title is not changing, or one of the closest solution was when I got it working as I need, but only on node/%/similar/all page, which is the wrong URL.

I'm trying to figure it out with different filters, values, validation criteria, etc.

Moreover, I need to be able to translate my View title to 7 languages, so I just can't change it through hook_views_pre_render setTitle method. Well, I suppose it is possible to write such a module, but I don't know how, and isn't there any other option?

πŸ’¬ Support request
Status

Fixed

Version

1.5

Component

Miscellaneous

Created by

πŸ‡·πŸ‡ΊRussia bigboy

Live updates comments and jobs are added and updated live.
  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the β€œVDC” tag instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024