ZF-9743: Add Support for typeKey of Property

Issue Type: Improvement Created: 2010-04-24T13:57:03.000+0000 Last Updated: 2011-05-25T22:54:25.000+0000 Status: Resolved Fix version(s): - 1.11.3 (01/Feb/11)

Reporter: Jon Whitcraft (sidhighwind) Assignee: Marc Hodgins (mjh_ca) Tags: - Zend_View

Related issues: - ZF-10796

Attachments: - ZF-9743.patch


Current the headMeta helper only supports three typeKeys (name, http-equiv and charset) but it should include for a typeKey of property for the new facebook OpenGraph api (


Posted by Jon Whitcraft (sidhighwind) on 2010-04-24T14:02:01.000+0000

See Attached Patch

Posted by Anton Visser (toneplex) on 2010-07-16T12:04:49.000+0000

This is becoming more and more important as web developers try to get better integration with social networks, so please could you push this up the priority order.

Posted by mayhem (mayhem) on 2011-01-02T16:35:50.000+0000

I agree with autor - thing is important enough to implement it

Posted by Marc Hodgins (mjh_ca) on 2011-01-03T01:13:17.000+0000

Improved patch attached which includes unit tests, documentation, and adds full functionality similar to the 'meta' and 'http-equiv' meta tag properties -- i.e. it is possible to do $this->headMeta()->setProperty('og:title', 'foo')

Posted by Marc Hodgins (mjh_ca) on 2011-01-03T01:22:22.000+0000

Applied to trunk in r23610, merged to 1.11 release branch in 23611.

Posted by mayhem (mayhem) on 2011-01-03T16:32:34.000+0000

I have test this patch and found that it requires setting XHTML1_RDFA doctype or using my own custom doctupe with "rdfa" string present on it. So if I use any other doctype, i can't set no Open Graph meta tags in document.

Official protocol specification" rel="nofollow">] says nothing about doctype.

[] don't use RDFa doctype [] don't use RDFa doctype

RDF documentation says that doctupe MAY be used instead of requisition.


{quote} Documents written using the markup language defined in this specification can be validated using the DTD defined in Appendix B. If a document author wants to facilitate such validation, they may include the following declaration at the top of their document:

ofollow" href="">"> {/quote}

This paragraph may be found also in [HTML 4.01 RDFa specification

So I must use custom doctype with "rdfa" string inside instead of predefined constant.

I propose to remove doctype testing

Posted by Marc Hodgins (mjh_ca) on 2011-01-04T01:52:00.000+0000

@mayhem, I understand your concern. But, since "property" is not a supported attribute in non-RDFa Doctypes, using headMeta() to generate OGP meta tags without an RDFa doctype causes the document to fail validation. This seems wrong to me - to default to allowing the generation of HTML that won't validate. Just because other sites don't validate doesn't mean that is the correct way to do it.

There are a lot of "watchers" on this ticket - anyone else care to comment?

Posted by mayhem (mayhem) on 2011-01-06T14:26:44.000+0000

nobody cares? ok, you convinced me to use XHTML_RDFA doctupe :)

Posted by Pete Nystrom (petenystrom) on 2011-05-25T20:32:59.000+0000

I still think things are off with the requirement of RDFa, and the validate function fails even if I do add the rdfa into the doctype declaration. My pages that have the following doctype:

ofollow" href="">">

Still fail to pass:

    // <meta property= ... /> is only supported with doctype RDFa
    if (!$this->view->doctype()->isRdfa()
        && $item->type === 'property') {
        return false;

If I comment out the return false the page loads fine with the correct og tags and the facebook share and like load perfectly. The og tags still work through facebook even if I don't change the doctype actually, so not sure why this is such a hard rule in the framework.

Thanks, Pete

Posted by Marc Hodgins (mjh_ca) on 2011-05-25T22:54:25.000+0000

@Pete, are you specifying the XHTML_RDFA doctype via the doctype view helper? See Example 21 here…

If you are manually setting the doctype (i.e. by hard-coding it in a view or layout instead of using the helper), the other view helpers (such as headMeta()) have no way to know that you have specified an RDFa-compatible doctype. So, the code in your example would be expected to return false. The framework does not know what doctype you are using unless you specify it with the doctype view helper.

It is a good idea to use the doctype helper to specify your doctype for reasons beyond this specific feature. For example, many view helpers (i.e. the form view helpers) check whether the doctype is specified as XHTML and adjust their output accordingly.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.