andamira / medula

Starter Theme & Plugin for WordPress
MIT License
8 stars 0 forks source link

og:tags (header) #42

Open jan-dh opened 9 years ago

jan-dh commented 9 years ago

I was wondering If you would (out of the box) have a some og:tags support in the header. I have a solution that I'm using now that checks:

I was planning on posting the code here but it's a lot, I'll do it as a pull-request in the header.

joseluis commented 9 years ago

When it's a lot of code I usually prefer to share it first via jsfiddle / codepen or something like that.

I see you already sent it #43. It's ok but even if we end up using it or a variation of it, that code won't live in the header but in an appropriate file under /theme/lib/ and will be called as a function.

I was planning to use some semi-automatic solution for microdata and/or schema.org too. Possibly related: #9

jan-dh commented 9 years ago

I'll see what I can do with the fiddles in the future :smile: The solution I posted is more focused on being able to share posts/pages easely on facebook. (by including an image, excerpt,...)

joseluis commented 9 years ago

I see. It's a good start. I like the idea, but it will need more work in order to integrate with the rest of the system.

For example I'd like to make og:type more versatile, to support custom post types easily. The same with og:image.

I'm thinking maybe creating a main function that accepts many or all og metadata as parameters, and several handy wrappers for the most common situations / templates.

Resources:

jan-dh commented 9 years ago

Things like image etc. are pretty basic. When you use the facebook-debugger tool you'll see what facebook needs to show your posts. You could also add author and some time-stamp. When I post a link from a single article from the site I used the header for it comes up like this:

image

Regarding the og:type, article and website are the two most relevant types available. So on a single post changing it to type and the rest to website seems pretty standard. People will always be able to overwrite things if they don't like it, but it provides a nice out-of-the-box result.

joseluis commented 9 years ago

Ok, that link is a good resource.

I'll include this feature for sure, but I have to think about the proper way to do it. The good thing is that we have all the info we need already.

joseluis commented 9 years ago

I've confirmed with the WP themereview team that open graph is plugin territory. So I'll put it inside the companion plugin.

Related: #45