Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce instances where photo is implied #21

Closed
aaronpk opened this issue Feb 25, 2018 · 5 comments
Closed

reduce instances where photo is implied #21

aaronpk opened this issue Feb 25, 2018 · 5 comments

Comments

@aaronpk
Copy link
Member

aaronpk commented Feb 25, 2018

Like #6, a similar thing is happening with the photo property.

I have a blocking issue on XRay where this is causing problems: aaronpk/XRay#55

Here is a URL with this problem: https://collect.readwriterespond.com/zenpress/

@sknebel
Copy link
Member

sknebel commented Feb 25, 2018

The example in aaronpk/XRay#55 is rule

else if .h-x>:only-child:not[.h-*]>img[src]:only-of-type:not[.h-*], then use that img’s src for photo

while https://collect.readwriterespond.com/zenpress/ triggers an even simpler step

else if .h-x>img[src]:only-of-type:not[.h-*] then use that img src for photo

@Zegnat
Copy link
Member

Zegnat commented Feb 25, 2018

On Aaron’s site it seems to accidentally catch the header graphic. But I wonder if there aren’t other examples of accidentally implied photos are out in the wild. Some things I can think of:

  • The implied rules do not exclude images that already have other explicit properties on them. An <img> with class="u-featured" could thus easily also be picked up for the photo property.
  • Are there examples – maybe from WordPress as well – where the only image on the page is a share button or logo of a site the post has been syndicated too? Those may also be picked up by this.

@gRegorLove
Copy link
Member

I have an example of this where an element with an explicit u-logo is also being parsed as implied photo. This is is an h-card for an organization, so I don't think it should have a photo property. Below is actual markup for the organization, but with generic contact info.

<div class="h-card">
	<img src="/logo.png" class="u-logo" alt="">

	<p>
		<b class="p-name p-org">Organization Name</b><br>
		<span class="p-street-address">1234 Example</span><br>
		<span class="p-locality">City</span>, <span class="p-region">State</span> <span class="p-postal-code">12345</span> <span class="p-country">US</span>
	</p>

	<p>
		Phone: <a href="tel:1234567890" class="p-tel">(123) 456-7890</a><br>
		Fax: (234) 567-8901
		Email: <a href="mailto:info@example.com" class="u-email">info@example.com</a>
	</p>
</div>
{
    "items": [
        {
            "type": [
                "h-card"
            ],
            "properties": {
                "name": [
                    "Organization Name"
                ],
                "org": [
                    "Organization Name"
                ],
                "street-address": [
                    "1234 Example"
                ],
                "locality": [
                    "City"
                ],
                "region": [
                    "State"
                ],
                "postal-code": [
                    "12345"
                ],
                "country": [
                    "US"
                ],
                "tel": [
                    "(123) 456-7890"
                ],
                "logo": [
                    "/logo.png"
                ],
                "email": [
                    "mailto:info@example.com"
                ],
                "photo": [
                    "/logo.png"
                ]
            }
        }
    ],
    "rels": {},
    "rel-urls": {},
    "debug": {
        "package": "https://packagist.org/packages/mf2/mf2",
        "version": "v0.4.3",
        "note": [
            "This output was generated from the php-mf2 library available at https://github.com/indieweb/php-mf2",
            "Using the masterminds/html5 HTML parser",
            "Please file any issues with the parser at https://github.com/indieweb/php-mf2/issues"
        ]
    }
}

@sknebel
Copy link
Member

sknebel commented Aug 22, 2018

Proposed resolution per IRC discussion right now:
Following the example of #36, replace

if no explicit "photo" property,

with

if no explicit "photo" property, and no other explicit u-* properties, and no nested microformats,

@tantek
Copy link
Member

tantek commented Dec 24, 2018

Resolution: proposal accepted.

No objections in above discussion, and positive opinions (👍) from three implementors on the proposal.

Proposal implementation in mf2py per microformats/mf2py#135 is sufficient to demonstrate implementability.

Editing specification accordingly.

(Originally published at: http://tantek.com/2018/358/t2/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants