XF 2.2 How to update Website schema to add Google site name?

dethfire

Well-known member
You can now add a name to the Website schema?

How can we do this in Xenforo. It appears the schema is behind this bit of code {$ldJsonHtml|raw}
 
You can now add a name to the Website schema?

How can we do this in Xenforo. It appears the schema is behind this bit of code {$ldJsonHtml|raw}
Isn't it already in Xenforo? Even if you inspect this page you're looking at, you'll find the attributes set under
Code:
<script type="application/ld+json">
 
The "name" attribute is not. That is what this thread is about.
But it is?

Code:
            <script type="application/ld+json">
                {
    "@context": "https://schema.org",
    "@type": "QAPage",
    "@id": "https://xenforo.com/community/threads/how-to-update-website-schema-to-add-google-site-name.209673/",
    "mainEntity": {
        "@type": "Question",
        "name": "How to update Website schema to add Google site name?",
        "text": "You can now add a name to the Website schema?\nhttps://developers.google.com/search/docs/appearance/site-names#json-ld\n\nHow can we do this in Xenforo. It appears the schema is behind this bit of code {$ldJsonHtml|raw}",
        "answerCount": 2,
        "upvoteCount": 0,
        "dateCreated": "2022-10-15T19:43:37+00:00",
        "author": {
            "@type": "Person",
            "name": "dethfire"
        },
        "suggestedAnswer": [
            {
                "@type": "Answer",
                "text": "Isn't it already in Xenforo? Even if you inspect this page you're looking at, you'll find the attributes set under\n\n<script type=\"application/ld+json\">\n\n\nThe \"name\" attribute is not. That is what this thread is about.",
                "dateCreated": "2022-10-15T21:23:23+00:00",
                "upvoteCount": 0,
                "url": "https://xenforo.com/community/posts/1595435/",
                "author": {
                    "@type": "Person",
                    "name": "dethfire"
                }
            },
            {
                "@type": "Answer",
                "text": "You can now add a name to the Website schema?\nhttps://developers.google.com/search/docs/appearance/site-names#json-ld\n\nHow can we do this in Xenforo. It appears the schema is behind this bit of code {$ldJsonHtml|raw}\n\nIsn't it already in Xenforo? Even if you inspect this page you're looking at, you'll find the attributes set under \n\n<script type=\"application/ld+json\">",
                "dateCreated": "2022-10-15T20:28:49+00:00",
                "upvoteCount": 0,
                "url": "https://xenforo.com/community/posts/1595429/",
                "author": {
                    "@type": "Person",
                    "name": "ENF"
                }
            }
        ]
    },
    "image": "https://xenforo.com/community/data/avatars/l/80/80733.jpg?1406642578",
    "interactionStatistic": {
        "@type": "InteractionCounter",
        "interactionType": "https://schema.org/ReplyAction",
        "userInteractionCount": 2
    },
    "publisher": {
        "@type": "Organization",
        "name": "XenForo community",
        "logo": {
            "@type": "ImageObject",
            "url": "https://xenforo.com/community/styles/default/xenforo/xenforo-logo-og.png"
        }
    },
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://xenforo.com/community/threads/how-to-update-website-schema-to-add-google-site-name.209673/"
    }
}
            </script>

Specifically...

Code:
 "publisher": {
        "@type": "Organization",
        "name": "XenForo community",
        "logo": {
            "@type": "ImageObject",
            "url": "https://xenforo.com/community/styles/default/xenforo/xenforo-logo-og.png"
 
According to Google's doc which I linked to, it needs to be nested in the "website" type.
You should have linked the actual introduction message, here: https://developers.google.com/search/blog/2022/10/introducing-site-names-on-search

From what I've researched, they are giving you an option to say that you can specify a specific name for your site. I tested my own site and the name is shown in the new format without having to change anything on my site (XF 2.2.x). If you want to display something different than what Xenforo produces, then you could add a modification to change the site name on the results. (I'm involved with a few different sites and 2 of them have the updated search results, but the others do not as of yet. They are however, the same version and no modification to the default schema setup in XF.)

Based on everything I've looked at, no action is required if you want your site name (as listed in Xenforo) to show up as the site name header in Google Search results. Action is required if you want a different name to show up when your site's search impressions are updated.
 
Based on everything I've looked at, no action is required if you want your site name (as listed in Xenforo) to show up as the site name header in Google Search results. Action is required if you want a different name to show up when your site's search impressions are updated.
This is the point of the thread. Maybe I should have created it in the customization forum. How to edit {$ldJsonHtml|raw}
 
Top Bottom