2

I need to hide the page title in Views but still have it appear as the page title on the browser's window tab (for SEO). Could someone help me with that? I've looked around many times for answers but I haven't had any luck yet.

4 Answers 4

0

This sounds like something that should be pretty easy to do with a CSS selector. The user won't see the title but all functionality outside of seeing it on the page will still work.

More specifically, you could add a rule to your css file like:

#page-title {
    display:none;
}
2
  • but that's going to affect ALL views... what if I just want a specific views not to show the title?
    – sly-gdk
    May 20, 2014 at 17:16
  • Each page has a class associated with it attached to the body tag, think the css class is based on the url. So for a page with url mysite.com/mypage you could make your CSS selector more specific like: body.page-mypage #page-title { display:none }; May 20, 2014 at 17:17
3

The CSS solution might not be the best for SEO purposes...
Another better alternative is to write in the page title field :

<No Title> 
or : to leave it blank

And the title wont be displayed

2
  • This will disable the title tag as well, so I can't tell what's worst. Jan 4, 2016 at 8:27
  • 2
    This is the best and easiest solution by far...I'm perplexed as to why others are even trying other solutions... Mar 14, 2016 at 8:03
-1
function module_block_view_alter(&$data, $block){
    if($block->delta == 'your view name or id'){
        $data['title'] = 'my new title';
    }
}
-3

unset the title in page preprocess hook

1
  • 1
    My experience has been that unsetting the title with the preprocess hook unsets all instances of the title and thus the page behaves as if there's no title at all so meta data is affected.
    – Rob
    May 20, 2014 at 17:11

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.