Skip to content

SEO Fields 4: Schema.org, automatic redirects & updated template functions

A big update for my SEO Fields plugin was just released and in this post I'd like to tell you a bit more about what was added, what was changed and what you need to check before upgrading.

JSON-LD Schema.org support

This release adds rendering of Schema.org data in JSON-LD format. You can set a Schema type for each section in your site, and the plugin will output structured data based on the type you selected and the meta fields you filled out in the plugin.

You can also customize the schema that get's put on the page, like in the example below. Internally the plugin relies on spatie/schema-org to create these objects. You can find more documentation here.

{# This line should go before any layout you're extending #}
{% do entry.setShouldRenderSchema(false) %}

{# @var schema \Spatie\SchemaOrg\Schema #}
{% set schema = craft.schema %}
{{ schema.organization
    .name("Studio Espresso")
    .email("[email protected]")
|raw }}

Automatic redirects when a URI changes

A smaller addition but something that is worth mentioning none the less: there now is a setting (enabled by default) that enables the creation of redirects automatically when the slug or uri changes for an entry.

Overwrite field values in Twig

This is something that used to work in Craft 3 but that has been broken for some time. In order to fix it, I've had to move a bunch of things around and change a number of template functions - so I'm happy to say this is once again something you can do.

Upgrading to version 4

If you're using the entry.seo.set... functions in your templates right now, be sure to read through the documentation here to ensure things don't break.

Updated documentation

I'm excited for this large update as it contains a bunch of things I've been meaning to add for a long time and it brings the plugin to a good place to start the upgrade to Craft 5 from.

I hope you'll give it a try if you haven't before, and should you run into any issues - feel free to reach out to me or to create an issue on GitHub.

SEO Fields

Full featured SEO solution with meta data, sitemaps, redirects & structured data

$59 Plugin Store Github

Studio Espresso

Studio Espresso Monthly

Once a month, I send out a personal newsletter where I talk about my work, life and interesting things I’ve seen and done. Broader than web development and a bit more personal. If you’re interested you can subscribe below.
© 2024 Studio Espresso