T3SEO

TYPO3 and SEO since 2011

og:url and og:type

Together with og:title and og:image, og:url and og:type make up the four mandatory fields of the Open Graph Protocol. In this article I'll introduce the two latter to you. Once again the implementation in TYPO3 is lean and easy.

Like the canonical url

og:url contains the distinct URL of the document and therefore is semantically identical to the canonical URL. That's why normally you should provide the same value for both meta data.

page.headerData.1038 = TEXT
page.headerData.1038 {
	typolink.parameter.data = TSFE:id
	typolink.forceAbsoluteUrl = 1
	typolink.returnLast = url
	wrap = <meta property="og:url" content="|" />
}

The snippet generates a clean link to the current page, but without considering possible necessary GET parameters. For more information how to create the distinct URLs you can read the article about canonical URLs.

Website or blog?

With og:type you can provide the type of the document. For the purpose of the semantic internet (of things) there is a big variety of options you can use. But speaking of websites there are only the types website, blog and article.

website or blog should only be used on the home page, article is dedicated to transient content like news or blog posts. The specification is not clear on how to categorize content without connection to actuality. As a workaround you also may want to use article or (if you're into semantics and going new ways) define a custom type. Apart from that I appreciate your proposals in the comments section.

page.headerData.1039 = TEXT
page.headerData.1039 {
	value = article
	wrap = <meta property="og:type" content="|" />
}
[treeLevel = 0]
page.headerData.1039.value = website
[global]

This snippets sets article as type for all pages, except for the page in the highest hierarchy level, to which it assigns the website type. It assumes that only your home page is on the highest level in the page tree. If you have organized your pages in another way you have to use PIDinRootline or other conditions to distinguish your home page.

Picture Credits: Unity by Stuart Herbert (CC BY-NC-SA 2.0)

og:url and og:type

    Related Topics

  • Open Graph