There doesn't seem to be an answer for Drupal 8 yet. I have the metatag module installed, it's a great module, but doesn't seem to address views at all. This post for Drupal 7 says that it comes with a 'metatag views' module, but, this doesn't seem to be true for Drupal 8. I've also tried to install metatag quick, but, that fails to do anything at all. So I'm stuck. Is there a way to do this programmatically in D8? How can I get this done?

  • 1
    The Views integration is covered by this issue. It is not finished yet, but you might attempt to apply the patch and see if it works. Dec 30, 2016 at 17:51

5 Answers 5


I actually believe my comment provides an answer to this question; it cannot be done yet...

But looking at the issue, it seems to be pretty active at the moment and it is planned for the first release candidate. There is a patch available and cgmonroe claimed it worked in his beta 11 version of the module.

So you can wait until RC1 is released, which will very likely contain the Views integration, or you can try to apply the patch.


Current version of Metatag module includes a submodule "Metatag: Views". Enabling this, you get a new section in your views editor to set all metatags available (specific tags are available in other submodules in a very drupal way). metatag: views

  • 2
    Should be the accepted answer now. Mar 16, 2018 at 16:22
  • 1
    Does it apply in drupal 8? May 17, 2018 at 16:24
  • 1
    Yes, of course. There's the question's tag too. May 24, 2018 at 17:19
  • 1
    It works for me in Drupal 8. After enabling Metatag: Views module (This module is come with metatag module) the above option is displaying in views. From that I set the title of the page.
    – user50292
    Jun 6, 2018 at 9:56

While we wait for the metatag module to catch up, I'm using something like this in my theme's .theme file:


function THEMENAME_preprocess_html(&$variables) {
    // Set up the tag structure that's always the same no matter what page you're on
    $tag = array(
        '#tag' => 'meta',
        '#attributes' => array(
            'name' => 'description',
            'content' => FALSE,

    // Switch on the current page path. Apparently Drupal 8 paths have leading slashes now
    switch(\Drupal::service('path.current')->getPath()) {
        case '/your/view/path':
            $tag['#attributes']['content'] = 'Your view’s description';
        case '/another/view/path':
            $tag['#attributes']['content'] = 'Another view’s description';

    // Only add the tag if an option matched the current path
    if($tag['#attributes']['content']) {
        // 'THEMENAME_meta_description' is my best guess for a good identifier.
        // Maybe there's something better?
        $variables['page']['#attached']['html_head'][] = array($tag, 'THEMENAME_meta_description');

I ended up turning all my View pages into blocks and then adding the block to a basic page. From there I can edit and add meta tags at will. Not an ideal solution, but should get us by until the new module is released. Thanks @Neograph734 for shedding some light on the issue.

  • 2
    That is a creative workaround. Nice find! Jan 13, 2017 at 19:47
  • 2
    @JoshCoast the Metatag Views module is now available as nessunluogo suggested Mar 20, 2018 at 21:03
  • 3
    Yeah Drupal is more flexible than a condom. :-D May 17, 2018 at 16:25

Please do following steps:
1) Install metatag module
2) Enable it 3) Now enable "Metatag: Views" module which is the child module of Metatag
4) Now clear the cache
5) Now go to views page
6) You can see the "META TAGS" option below the "LANGUAGE"
enter image description here 7) Now either you left the "Using defaults" option or just click it and change the meta title of the page
8) This title will set for default language content
9) For other language content, you need to go to translate a page of same views
10) First, translate the views
11) Edit the translated view
12) Now search the "Page title" under "PAGE DISPLAY SETTINGS"
enter image description here 13) Change the title accordingly
14) Save it
15) See the meta title of other language page it will changed now
16) Please do cache clear if that it not reflect

  • 1
    Thanks! When I posted this a year and a half ago, the module didn't have this feature. Looks like it does now. Thanks for the walkthrough. I bet this will help someone.
    – Josh Coast
    Jun 24, 2018 at 21:03

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.