silverstripe / silverstripe-cms

Silverstripe CMS - this is a module for Silverstripe Framework rather than a standalone app. Use https://github.com/silverstripe/silverstripe-installer/ to set this up.
http://silverstripe.org/
BSD 3-Clause "New" or "Revised" License
516 stars 333 forks source link

Dedicated (meta) title tag #2596

Open brynwhyman opened 4 years ago

brynwhyman commented 4 years ago

With the desire to have an accurate page title for SEO purposes, it's pretty common to want to set a meta title tag that's different to the page title that's saved in the CMS.

Currently, the framework sets the title tag to inherit the page title. I think that's a good default as it requires no further action by the content author but for many, modifying this shouldn't require a Developer to set up a custom field (IMO).

It would be nice for the CMS to have a dedicated field to add a meta title tag on the base page. If a value was entered here it would override the default page title value.

Docs on how this currently works here: https://docs.silverstripe.org/en/4/developer_guides/templates/common_variables/#meta-tags

kinglozzer commented 4 years ago

We had this in core in 3.0, and it was removed (I can’t remember why, but it still seems short-sighted to me!), so I copied the functionality out into a module: https://github.com/kinglozzer/silverstripe-metatitle. I’d be in favour of adding this back in to the CMS module - it doesn’t make much sense IMO to include the option of custom meta tags but not include a simple meta title field.

christopherdarling commented 4 years ago

Agree with @kinglozzer use his module on every site

brynwhyman commented 4 years ago

@kinglozzer I think the functionality in your module as it stands would make a great addition to the CMS module.

chillu commented 3 years ago

I've removed this way back in the day because it didn't strike me as a baseline CMS feature, and can easily be handled in a module. In hindsight, I might have underestimated how many authors and site owners value this feature for SEO purposes. Note that you can already distinguish the navigation title (often shorter, shown in menus) from the page title (often longer, shown in page body, browser title, search engines, CMS page tree).

Could you describe the use case for a third way to set the title? Note that Google recommends using <title>, and even in its create good titles advice only references <meta description> rather than <meta title>

kinglozzer commented 3 years ago

Could you describe the use case for a third way to set the title?

It’s usually for SEO - not necessarily ranking these days, but often as a one-line sales pitch - where the content you want to use wouldn’t make sense as an h1. E.g. bigfork.co.uk has a <title> of Bigfork - Digital Marketing & Web Design Agency - Norwich & Cambridge, and that’s what shows up in Google search results, but the h1 on the page is different. It’s probably possible to achieve the same with hidden h1s, but I think that’s generally frowned upon

Note that Google recommends using , and even in its create good titles advice only references \<meta description> rather than \<meta title></p> </blockquote> <p>Yep, the module also uses the title tag - no idea why it’s called a “meta title” when it isn’t a meta tag but that’s what I’ve always been told!</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/chillu"><img src="https://avatars.githubusercontent.com/u/111025?v=4" />chillu</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>lol OK that got me confused, I thought it was setting <code><meta name="title"></code> rather than <code><title></code>. Yep that makes sense. Another use case I've seen is temporary title changes, e.g. "NHS London: Vaccines - Vaccine delivery expected on 10th of Jan". </p> <p>The problem with re-adding this to core is that lots of templates would've been built without the required conditional. It's still in place in the <a href="https://github.com/silverstripe/silverstripe-simple/blob/master/templates/Page.ss">simple theme</a> and <a href="https://github.com/silverstripe/cwp-watea-theme/blob/3/templates/Page.ss#L5">cwp theme</a>, but that doesn't mean much.</p> <p>I can't think of a way to reintroduce this into core without misleading some users about the new feature: It might not work in their specific template. And if we make it an opt-in by developers after checking their "theme compatibility", we might as well ask them to install that module. </p> <p>Also, how would this new core feature behave when a field with the same name has already been added? Does the ORM handle this gracefully?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/kinglozzer"><img src="https://avatars.githubusercontent.com/u/1655548?v=4" />kinglozzer</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>Yeah perhaps we’d be better off leaving it as a module for now and re-adding it to the next major version instead?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/christopherdarling"><img src="https://avatars.githubusercontent.com/u/178039?v=4" />christopherdarling</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>We use a module, usually @kinglozzer's one for 95% of projects (thanks Loz). If it's not able to be added to the core until a major, what about adding it as a suggested composer package for the time being?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/chillu"><img src="https://avatars.githubusercontent.com/u/111025?v=4" />chillu</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <blockquote> <p>what about adding it as a suggested composer package for the time being</p> </blockquote> <p>Dunno, we'll easily end up with dozens of "suggested" packages. I'd rather do this via docs, which enables Silverstripe devs to discover modules and add them to their own "project starter kits". The module is on <a href="https://addons.silverstripe.org/add-ons?sort=relative&start=64">page five</a> of the most popular modules on the addons site, so I'd argue it's reasonably discoverable. </p> <p>Loz, Christopher, maybe you want to publish your own "project starter kit"? We could add a "discover" section to the addons site which links off to these repos? Also, either of you keen to write a quick blog post about SEO? It's been a while: <a href="https://www.silverstripe.org/blog/tag/seo">https://www.silverstripe.org/blog/tag/seo</a></p> <p>So in conclusion, there's many ways to ensure cms users get a great experience, other than the sledge hammer of "include it in core" :)</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/kinglozzer"><img src="https://avatars.githubusercontent.com/u/1655548?v=4" />kinglozzer</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <blockquote> <p>So in conclusion, there's many ways to ensure cms users get a great experience, other than the sledge hammer of "include it in core" :)</p> </blockquote> <p>In my opinion it still belongs in core just as much as <code>MetaDescription</code>/<code>ExtraMeta</code>, so my preference would be to re-add it for 5.0. I don’t feel too strongly about it though - we do already have our own starter kit that includes it - I just thought I’d chime in on this issue 😄 </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/chillu"><img src="https://avatars.githubusercontent.com/u/111025?v=4" />chillu</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>I'm OK for this to be re-added to 5.x, although there's not much drive at the moment to push new things into that branch and stabilise it. Christopher and Loz, can either of you send a pull request to <code>recipe/cms</code> as well as the relevant themes?</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>