Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2017-02-07 11:38:20

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,049
Website

Re: JSON-LD instead of Microdata in default templates

Just as a side note, I’ve now added JSON-LD (along with other meta changes) to these forums and also the docs site. New .com site will also have some (limited) JSON-LD to compliment the microdata within its pages.

Offline

#12 2017-02-08 09:01:34

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,203
Website

Re: JSON-LD instead of Microdata in default templates

I starting to add JSON-LD into my personal (not finished yet) website.

This browsers extension could be useful for anyone wants to visualize and validate their snippets throughout their websites: http://osds.openlinksw.com/


Patrick.
G+
Github | CodePen

Offline

#13 2017-02-08 10:36:29

Destry
Moderator
From: Haut-Rhin
Registered: 2004-08-04
Posts: 3,887
Website

Re: JSON-LD instead of Microdata in default templates

Merci, Patrick !


More trees, less people.

Offline

#14 2017-02-09 09:04:33

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,502
Website

Re: JSON-LD instead of Microdata in default templates

Pat64 wrote #303884:

This browsers extension could be useful for anyone wants to visualize and validate their snippets throughout their websites: http://osds.openlinksw.com/

That is a bit weird – they ask to basically disable some browser security mechanism to use their extension. In Firefox, you can use the Get Info (Cmd / Ctrl I) window to view all the meta data.

I’ve started using json-ld snippets as well, particularly for individual articles. I don’t worry to much about the Google testing tools complaining about some missing fields (image in particular)1, as my primary aim is providing meta data for a scrapping tool used by some scientist (the site is social sciences oriented).

1 Note that the hissy fits thrown by the Google testing tool only really matter if you are using AMP pages; if you don’t (we don’t care about those, we have fast loading site, and don’t see the need to give on some data), most fields are optional anyway. See this Google page, and scroll down, there is a comparison table (“Property list for article structured data”).

Offline

#15 2017-02-09 09:50:26

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,049
Website

Re: JSON-LD instead of Microdata in default templates

phiw13 wrote #303910:

Note that the hissy fits thrown by the Google testing tool only really matter if you are using AMP pages…

I’m building AMP pages into the new Textpattern.com site (just for the blog articles). You can satisfy the AMP rich snippets image requirement by having a fallback image in your AMP template’s JSON-LD like so:

<script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "BlogPosting",
        "headline": "<txp:title />",
        "mainEntityOfPage": "<txp:permlink />",
        "datePublished": "<txp:posted format="iso8601" />",
        "dateModified": "<txp:modified format="iso8601" />",
        "description": "<txp:meta_description format="" />",
        "author": {
            "@type": "Person",
            "name": "<txp:author />"
        },
        "publisher": {
            "@type": "Organization",
            "name": "Textpattern CMS",
            "logo": {
                "@type": "ImageObject",
                "url": "http://textpattern.com/assets/img/branding/textpattern/textpattern.png",
                "width": "320",
                "height": "60"
            }
        },
        "image": {
        <txp:if_article_image>
            <txp:images limit="1">
            "@type": "ImageObject",
            "url": "<txp:image_url link="0" />",
            "width": "<txp:image_info type="w" />",
            "height": "<txp:image_info type="h" />"
            </txp:images>
        <txp:else />
            "@type": "ImageObject",
            "url": "http://textpattern.com/assets/img/branding/textpattern/textpattern-amp.png",
            "width": "696",
            "height": "390"
        </txp:if_article_image>
        }
    }
</script>

Offline

#16 2017-02-09 11:56:02

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,502
Website

Re: JSON-LD instead of Microdata in default templates

philwareham wrote #303911:

I’m building AMP pages into the new Textpattern.com site (just for the blog articles). You can satisfy the AMP rich snippets image requirement by having a fallback image in your AMP template’s JSON-LD like so:

Yes, I know how to do that, but that fallback image is not really (directly) related to the article, isn’t that a sort of requirement?

I’ve no idea how AMP pages display in G’s search results. I very rarely use Google, much less on a mobile phone which I don’t have, and Google Japan doesn’t seem to work as the Google US in this regard, as far as I can tell.

Offline

#17 2017-02-09 13:24:26

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,049
Website

Re: JSON-LD instead of Microdata in default templates

Yes, it’s not ideal and I’d encourage all our blog writers to have a unique image per every article, but given that the AMP result snippet simply will not be displayed in Google results unless it has an image associated with it then it’s a fair compromise.

Another reason why I’m not using JSON-LD for the default theme.

Offline

#18 2018-08-16 08:43:23

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,203
Website

Re: JSON-LD instead of Microdata in default templates

philwareham wrote #303916:

Yes, it’s not ideal and I’d encourage all our blog writers to have a unique image per every article, but given that the AMP result snippet simply will not be displayed in Google results unless it has an image associated with it then it’s a fair compromise.

Another reason why I’m not using JSON-LD for the default theme.

Not so sure about that. JSON-LD is just an object, so we can create an array of object entries into it.

For example, this sample below passes the validation throughout the Google Rich Snippets Testing Tool (https://search.google.com/structured-data/testing-tool):

<script type="application/ld+json">
{
	"@context": "http://schema.org",
	"@type": "BlogPosting",
	"mainEntityOfPage": "http:\/\/example.com\/",
	"headline": "Headline",
	"datePublished": "2018-06-09T15:09:51Z",
	"dateModified": "2018-06-09T15:09:51Z",
	"description": "Description",
	"articleSection": "Section Title",
	"keywords": [
    	"Category 1",
        "Category 2"
      ],
	"image": [
    {
		"@type": "ImageObject",
		"url": "http:\/\/example.com\/images\/1.jpg",
		"height": 200,
		"width": 300
	},
    {
		"@type": "ImageObject",
		"url": "http:\/\/example.com\/images\/2.jpg",
		"height": 200,
		"width": 300
	}
    ],
	"author": {
		"@type": "Person",
		"name": "Author's Name"
	},
	"commentCount": 6,
	"comment": {
		"text": "Comment text",
		"author": {
			"@type": "Person",
			"name": "Bob"
		}
	},
    "publisher": {
		"@type": "Organization",
		"name": "Blog Name",
		"logo": {
			"@type": "ImageObject",
			"url": "http:\/\/cdn.ampproject.org\/logo.jpg",
			"width": 600,
			"height": 60
		}
	}
}
</script>

May be I need to update my JSON-LD collection for Textpattern: https://github.com/cara-tm/JSON-LD/

Last edited by Pat64 (2018-08-16 08:45:48)


Patrick.
G+
Github | CodePen

Offline

Board footer

Powered by FluxBB