For a content type (Article), when I create a new node and save it, I want to append a field value (for example, Location) to the node title.

There seems to be great answers using custom plugins (Modify the node title with the node ID before saving it) and even modules (How do I build the node title from field values when saving the node?), but they're not applicable to Drupal 9.

If the suggested solution requires creating custom module and overriding a function, then please direct me to some implementation guide and specify files locations as I'm a newbie in writing Drupal code.

1 Answer 1


To do this without writing code, the module you want for Drupal 9 is Automatic Entity Label. Nodes are entities, so you can use this to set the label (title).

  • I will give a try right now, does it provide ability to insert the modified title while saving the node? Or it will update the node after being saved?
    – Cortex
    Feb 9, 2021 at 7:18
  • @Cortex It generates the node title based on the pattern that you give it when the node is saved for the first time. There's no need to re-save the node. Feb 9, 2021 at 7:20
  • Great! I will respond to the answer once I give it a try
    – Cortex
    Feb 9, 2021 at 7:21
  • Worked as expected! Also Pathauto was able to pick the title and use it to generate my custom pattern without issues, I verified the title value in the Database.
    – Cortex
    Feb 9, 2021 at 7:42
  • 1
    I'd just like to add the I had to add a new text field (Article Title) to use its token in the replacement along with 'Location'. Title field will be hidden and the token [node:title] will not work. You can update all previous nodes by ticking the option: Re-save in from 'Automatic Label' tab.
    – Cortex
    Feb 9, 2021 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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