• Hello! I would like to suggest a few improvements that I think could make your plugin even better.

    1. Schema. In WebPage schema markup, the inLanguage property contains the language value with a “_” separator, such as en_US, but it should be en-US. In Schema.org, the inLanguage property should contain the language value in the format en-US, that is, with a hyphen between the language code and the country code, if present. This complies with the IETF BCP 47 standard, which defines language tag formats. BCP 47 uses a hyphen (-) to separate parts of the language tag, including the language code (e.g. en) and the country code (e.g. US).
    Therefore, you need to replace the get_locale() function with get_bloginfo( ‘language’ ) in the file:
    \src\Schema\Types\WebPage.php
    The get_bloginfo( ‘language’ ) function in WordPress returns the language code in a BCP 47 compliant format (e.g. “en-US”). This is exactly what schema.org requires for the inLanguage property.

    I suggest adding the “potentialAction” property to the WebPage schema markup for the “post” and “page” content types with the value of an object with the ReadAction type, so that it would display in the page code:

    {
    "@type": "WebPage",
    "@id": "https://example.com/hello-world/#webpage",
    "url": "https://example.com/hello-world/",
    .........
    "potentialAction": {
    "@type": "ReadAction",
    "target": "https://example.com/hello-world/"
    }
    }

    And for the main page of the site, add the “about” property in the WebPage markup with the value:
    "about":{"@id":"https://example.com/#organization"}}

    For the WebSite schema markup, add the “description” property with the value of the site’s Tagline and the inLanguage property:
    'description' => get_bloginfo( 'description' ),
    'inLanguage' => get_bloginfo( 'language' ).

    For the ImageObject schema markup, add the “contentUrl” property, which will duplicate the contents of the “url” property. Because Google and Yandex prefer the “contentUrl” property:
    https://developers.google.com/search/docs/appearance/structured-data/image-license-metadata#structured-data-type-definitions
    https://yandex.com/support/images/schema-org.html.

    For the ProfilePage schema markup, add the “mainEntity” property, because it is required for ProfilePage:

    "mainEntity": {
    "@id": "https://example.com/#/schema/person/97c3ca9bc3b52d46fa27dff34cb4fe05"
    }

    And from the Person object, remove the “mainEntityOfPage” property on the author page, because it is not required there.
    According to the documentation, the “mainEntity” property in the ProfilePage schema markup is mandatory, while “mainEntityOfPage” is not required for Person:
    https://developers.google.com/search/docs/appearance/structured-data/profile-page.

    Add the ability to specify links to social network accounts (Facebook, X (Twitter), and others) for the “sameAs” property of the “Organization” schema markup to link the organization to its profiles elsewhere on the network. And also add links to other resources for authors in the “sameAs” property for “Person”, which will contain links to the author’s accounts in social networks and other resources.

    2. Open Graph and Twitter Card. Add Open Graph tags article:author, article:publisher, twitter:creator, which will contain links to the author’s Facebook page, the organization’s Facabook page, and the author’s X (Twitter) page, respectively.

    3. Date and time in ISO 8601 format, taking into account the time zone. Make the date and time in the “datePublished” and “dateModified” properties in the WebPage and Article schema markup, sitemap.xml, and Open Graph article:published_time, article:modified_time, og:updated_time tags display with the time zone set in the site settings. For example, if the Timezone in the site settings is set to UTC-5, then the time and date should be, for example, 2024-10-08T07:37:04-05:00.
    Many WordPress themes on the post pages display the time tag in the code with the datatime attribute <time datetime="2024-10-08T07:37:04-05:00">, which displays the date and time taking into account the Timezone. I assume that you need to replace the gmdate() function with wp_date() in the files:
    \src\Schema\Types\WebPage.php
    \src\Schema\Types\Article.php
    \src\MetaTags\OpenGraph.php
    \src\Sitemaps\PostType.php

    Rank Math and SEOPress display the date and time taking into account the Timezone.

    4. Meta robots tag. Make sure that the comment pages and replytocom, for example:
    https://example.com/hello-world/comment-page-1/#comments
    https://example.com/hello-world/?replytocom=1#respond
    to avoid duplicate content, are not indexed using the meta tag:
    <meta name='robots' content='noindex, follow' />
    It is also worth prohibiting indexing of date archives.
    I have disabled indexing for now with this code:

    add_filter('wp_robots', function($robots) {
    if (is_date() || (is_singular('post') && get_query_var('cpage')) || isset($_GET['replytocom'])) {
    return array(
    'noindex' => true,
    'follow' => true
    );
    }
    return $robots;
    },
    999);

    5. Unnecessary menu at the end of “Canonical URL” field on the page for adding a post. On the post adding page, there is a “Canonical URL” field, which has an option to call the menu via three dots at the end:

    View post on imgur.com


    It is not needed there, because only a link can be specified in this field, so the selection of variables is not needed there.

    6. Priority of output of meta tags in HTML code. Make all meta tags appear at the top of the <head> section by setting the priority to 1 in the add_action( ‘wp_head’, [ $this, ‘output’ ], 1 ) function in the files:
    \src\MetaTags\Description.php
    \src\MetaTags\OpenGraph.php
    \src\MetaTags\CanonicalUrl.php
    \src\MetaTags\TwitterCards.php
    \src\MetaTags\RelLinks.php
    \src\MetaTags\LinkedIn.php

    Your plugin is great, but I would like to see the improvements described above.`

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi @stranger03 ,

    Thanks a lot for your feedback. That’s so valuable. We’ll put these suggestions in our todo list and will work on them.

    Plugin Author Anh Tran

    (@rilwis)

    Hi @stranger03 ,

    We’ve just released a new version with some changes, regarding your suggestions:

    1. Schema
    3. Date & time: this is not a bug, since we were using GMT timezone to output the value. As the datetime format was “c”, the info is correct. However, switching to wp_date might help “people” seeing the value easier (not value for bots, though).
    4. robots tag: WP auto does for ?replytocom, so we only have to do for paginated comment pages. This is opinionated, since comment pages have different content (from comments), and sometimes it’s useful. However, in most cases, it’s not needed. We also remove “noindex” for internal search page as it’s already set noindex by WP.
    6. Priority of meta tags: it’s not necessary to be on the top of <head> section. But we did that anyway, just for the familiarity as in other plugins and for users to easier to inspect the values.

    Regarding other issues:
    2. Link to social profiles: we’ll do that in a next version
    5. Remove dynamic variables for canonical URL: it’s not needed, as sometimes, people might want to use custom field for this meta tag (like they import from another source and want to keep the canonical URL point to the original source). Then dynamic variables help.

    Thread Starter Dmitry

    (@stranger03)

    Hello Anh Tran! In schema markup: an object with type ReadAction is missing from the “@graph” array, although WebPage now has a “potentialAction” property containing the value {"@id":"https://example.com/hello-world/#readaction"}
    Regarding the display of dates: I forgot to mention in this topic about the file \src\MetaTags\LinkedIn.php, in it you also need to replace gmdate() with wp_date().

    Thread Starter Dmitry

    (@stranger03)

    You need to add the “@id” property to the \src\Schema\Types\ReadAction.php file so that there is a connection with the “potentialAction” property of the WebPage markup.
    Like this:

    namespace SlimSEO\Schema\Types;
    
    class ReadAction extends Base {
    	public function generate() {
    		return [
    			'@type'  => 'ReadAction',
    			'@id' => $this->url . "#readaction",
    			'target' => $this->url,
    		];
    	}
    }
    Plugin Author Anh Tran

    (@rilwis)

    Hi @stranger03 ,

    Thanks for your feedback. We’ve fixed these issues in this PR. And it will be included in the next version.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.