1

I want to change the title of the node/add page of a specific content type. Twig debug only shows me file names that would also change the titles of other content types. There was a module for this in D7, but unfortunately it was not ported to D8.

1

2 Answers 2

2

If you can hide the default page title using CSS, then you could create a custom block for the title and specify to have it show only on the content you want.

In the block configure visibility settings, set the page visibility to be restricted to your content type.

-- But, hiding the default page title block that will only work for you if the admin theme is using the same theme as the front-end site.

I think the admin page title is still passing through that Page title block (the default).. so maybe you can configure that block's visibility to hide on the edit pages where you want your custom block to appear?

1
  • The admin page doesn't matter, only the front end appearance is important
    – 0711master
    Mar 25, 2022 at 19:38
1

Simply use Metatag module. This is the no-code solution.

Use the metatags configuration for the specific content type. And then modyfy the Title field. With the Token module you have more power to modify the title.

Here and here is some documentation about how to use metatgs.

5
  • Apparently this option only changes the text within the title tags?
    – 0711master
    Apr 13, 2022 at 15:20
  • @0711master yes. Otherwise - the question doesn't make sense, since you can edit the node title from the node edit form. If need automatically set the node title per content type - then use the module autotitle Apr 13, 2022 at 18:30
  • Ah ok, I need to clarify: if you open any node/add page then the title you see directly above the node form is like "Add @type" with type being the name of the content type. This is the title I'm talking about.
    – 0711master
    Apr 14, 2022 at 14:11
  • Then - see the answer at the bottom of your question: You could alter the route and replace this title callback NodeController::addPageTitle. Apr 14, 2022 at 20:07
  • Thank you and I hope you are safe!
    – 0711master
    Apr 15, 2022 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.