Recently I attempted to find the best method by which to enhance SEO and user happiness for a site by generating better meta tags and title control.  CMS tools such as Joomla do great for handling meta information for articles and links, but what about for custom generated content.  As I have been exploring some new ways to generate some custom applications inside of Joomla, I have encountered at least a few situations where I wanted to generate some custom edits to the header tags from inside of a piece of content.

Enter the JFactory::getDocument() object.  Inside of my component/page/module (when using a  a simple call to the JFactory::getDocument will give me the ability to modify components of the header for the page.  Here is an example of how to make use of it:

$document = JFactory::getDocument();
$document->setTitle('My Awesome Page | Brobot Industries');
$document->setMetaData('description','Quite literally... all of the awesome');
$document->addCustomTag('<meta property="og:image" content="http://link.com/to/your/image.png" />');

I know that there is some great documentation here and here, but I wanted to call it out specifically.  Using these tags you can control your SEO as well as the OpenGraph settings for your page.  You could add images or other custom tags that you want in the header.