Better Title Tag formats

#2 · closed · 6 comments

View on GitHub ↗

ghosh

Currently the title tags show up as:- ``` html <meta name="title" content="This is the page title."> ``` However, this doesn't show up either at the top of a browser's chrome nor in its tabs. A better way of printing them on the screen would be:- ``` html <title>This is the page title</title> ``` The current approach of printing meta tags has a few downsides too. For more info you can have a look at [this answer](http://stackoverflow.com/a/21076311/1253621) on stackoverflow.

Comments

RyanNielson

This is expected behaviour because, as in the packages name, this project's job is to print meta tags.

ghosh

Hmm..agreed. However, the title tag is considered one of the most important meta tags and generally always associated with the description and keywords meta tag. It just feels a little strange that the package prints the title meta tag but not the title tag itself. Maybe an optional field of `pageTitle` in the array passed to `Meta::set()` which prints the title tag?

RyanNielson

I'll look into making `display()` take an optional argument called `displayTitle` or something that you can set to true if you want a title tag rendered as well.

ghosh

That would be awesome! Thanks a bunch.

RyanNielson

@Ghosh I just released version 1.1.0 which adds the title tag rendering you requested. Basically when calling `display` there is an optional second argument to render the title tag. So if you set some meta attributes, you can do something like `display(array(), true)` to render the title tag. This will render the title tag below the other meta tags.

ghosh

Thanks for the quick implementation. Enjoy using your packages.