ZF-9743: Add Support for typeKey of Property

Description

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 (http://developers.facebook.com/docs/opengraph).

Comments

See Attached Patch

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.

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

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')

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

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 www.w3.org/TR/rdfa-in-html/" rel="nofollow">http://ogp.me/] says nothing about doctype.

[http://www.imdb.com/title/tt0117500/] don't use RDFa doctype [http://www.pravda.com.ua/news/2011/01/3/5746644/] don't use RDFa doctype

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

[http://www.w3.org/TR/2010/WD-xhtml-rdfa-20100803/]

{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="www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"> {/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

@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?

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

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="www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">

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

@Pete, are you specifying the XHTML_RDFA doctype via the doctype view helper? See Example 21 here http://framework.zend.com/manual/en/…

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.