The Contentful SEO guide
SEO for URLs & redirects
Joshua Lohr, Rob Remington, Nick Switzer, Allan White
Updated: December 6, 2023
The Contentful SEO guide
This is chapter 6 of the series,The Contentful SEO guide.
Summary
URLs and redirects are a key piece of both the organizational structure of your website and the findability of your content for search engines. Both can be managed as content in Contentful, but we recommend taking care to ensure your governance rules ensure a small set of users who understand the impact of their work can create and edit them.
URL slugs
Before we talk about slugs, let’s first discuss URLs in general. URLs help search engines to understand:
- the structure of your site (through folder organization), and
- your page’s content (through keyword usage in URL slugs).
In Contentful, the URL path can be configured to allow content creators to choose the folder in which the page falls in, however, depending on your content model, you may want to limit this to ensure content creators choose the appropriate path. In our “Building Block: Essentials” content model, we allow for content creators to select where the entry will be housed, or to select “no prefix” which places the entry at the root.
This feature shows the power of a headless CMS and the SEO benefit of Contentful to seamlessly place or move content wherever you like. Remember the days of monolithic CMSes, wherein you were limited to where you put pages and empty folders were common? This was a true productivity inhibitor. With a headless CMS, you can publish content anywhere you want it. This allows you to use clear, concise, and hierarchically organized folder structures with ease.
Beneath the URL prefix, we have the URL slug, which we’ve configured to generate based on the Entry Title (which can likewise be configured to remove stop words and special characters, as well as use lower case). Content creators can override the auto-generated URL slug by editing this field, though you may want to put limitations here.
Optimization tips
URL slug pitfalls, such as using file extensions (e.g., .html), are thankfully taken care of and prevented by Contentful. That said, it’s still a good idea to ensure the following is included in your URL slugs:
- Keywords: Include descriptive phrases/keywords in URL slugs and subfolders.
- Casing: Always use lowercase in URL slugs.
- Conjunction: Avoid conjoining words in URL slugs, “likethisexample,” and instead separate words with hyphens “-” to ensure they are readable by users and search engines alike.
- Special characters: Avoid non-ASCII characters in URLs, such as parentheses, brackets, semicolons, % and @ symbols, etc.
Validation & help text
Validation
Configure your URLs to avoid the pitfalls above and use SEO best practice.
Help text
- Here’s an example of what you can put in the Help text field which will show up below the URL prefix field and help content creators select the appropriate URL path:
“A slug prefix for the page URL. If noPrefix selected, the slug will not have a prefix.”
- Here’s an example of what you can put in the Help text field which will show up below the URL slug field and help content creators craft the ideal URL slug:
“This field is auto-generated using the entry title, which should already include keywords. Avoid upper case, conjoined words “likethisexample” (separating words with hyphens “-”), and special characters (such as
, ; [ { @ % $
, etc.).”
Canonical link element
Canonicals are often one of the most confusing elements, and rules for these can get quite complex. We’ll stick to the basics here for simplicity while still tackling the most common use cases and pitfalls.
The canonical link element is a tag that helps prevent duplicate content issues by specifying the "canonical" or "preferred" version of a URL. This is critical since this SEO element controls indexation in organic search results and is an element Google typically obeys.
Optimization tips
- Ensure the preferred version of a URL is indexable by specializing the preferred version of a page using the canonical link element. This may mean that the canonicals for paginated results or filtered content (perhaps through faceted navigation) are pointing at the root URL without parameters, if this is preferred. The benefit here is that earned SEO value is consolidated to the root URL, thus increasing the page’s ability to rank through the reduction of cannibalization.
- On the flip side of the above, ensure all canonical link elements are indexable, meaning that the canonicalized URLs can be crawled and properly indexed by search engines. This issue is more common than you may think. You can test the indexability using Google Search Console’s URL Inspection Tool.
Validation & help text
Validation
- For paginated results, UTMs, or other tracking parameters, have the canonical default to the root URL, if, of course, this is preferred. There are some edge cases where you may want these pages indexed. When in doubt, consult an SEO professional for guidance.
- Faceted navigation, such as on an ecommerce site, adds another layer of complexity. With this, we recommend using static paths for critical categories, while limiting facets to only create static URL variations that would be beneficial to have indexed in search results. Consolidating these facets tends to give your category pages a better chance to rank though SEO value consolidation and cannibalization reduction. Again, this may not be preferred and we recommend consulting an SEO professional for further guidance if you are unclear on how to best position your URLs.
- If you configure canonicals with validation like the above at the site level, then you probably don’t need to allow content creators to edit this field since it can be confusing and an SEO risk for the average content creator to edit.
- However, there are situations where it can be beneficial to allow content creators to set a canonical URL. One example is where you want to canonicalize a page to a URL published on an external domain to prevent duplicate content. Because we often canonicalize to the exact content published on partner sites and exact content published on personal developer blogs, we allow content creators to specify a canonical other than the default to prevent duplicate content.
- Note, since this only applies to external URLs, we include this in our content model as the “External URL” field. You may want to simply specify this as “Canonical Link Element” or something else, depending on your needs. Given how impactful this can be to your SEO strategy, we recommend creating a user role that grants access to edit this field for a very limited group of SEO-focused content creators.
Help text
Here’s an example what you can put in the Help text field if you decide to follow our content model as specified above for the External URL field:
“If this article is a repost from an external source, please put the URL of the original article here.”
Redirect management
URL redirects prevent dead ends (e.g., 404 errors) and get users to where they need to be when a URL has changed. They are also critical to retaining SEO value a page has earned throughout its existence. This can be either for a page that is temporarily moved or is permanently sunsetting.
The primary types of redirects:
- Permanent move: A 301 redirect is a permanent redirect, signally to search engines to index the destination URL and pass all earned SEO equity to the destination URL.
- Temporary move: A 302 redirect is a temporary redirect, signally to search engines to retain indexation of the origin URL and retain all earned SEO equity at origin URL.
- Avoid these: A meta refresh is a client-side redirect that executes after a certain period of time. These have been abused over time so much so that search engines recommend against using them.
Optimization tips
- Use 301 redirect status by default, allowing for usage of 302 redirects where needed.
- Avoid usage of meta refresh redirects at all costs.
Validation & help text
Redirects can be managed just like content types in Contentful. They need to be configured as a content type and then they can be managed similar to how you might manage any site component:
“From” field:
- Create a “Text” field type, select “Short text” field, and mark “This field represents the Entry title.”
- Mark as a “Required field” and as a “Unique field.”
- Here’s an example of what you can put in the “Help text” field which will show up below the “From” field and provide content creators guidance on which URL to put where:
“Enter the old URL you would like users to be redirected from.”
- For the above help text, you may want/need to specify that users enter a relative or absolute URL path if your configuration relies on that.
“To” field:
- Create a “Text” field type and select “Short text” field.
- Mark as a “Required field” only.
- Here’s an example of what you can put in the “Help text” field which will show up below the “To” field and provide content creators guidance on which URL to put where:
“Enter the URL you would like users to be redirected to.”
- Again, for the above help text, you may want/need to specify that users enter a relative or absolute URL path if your configuration relies on that.
“Permanent” field:
- Create a “Boolean” field type.
- Mark as a “Required field.”
- Leave the “True” condition as set to “Yes” and the “False” condition as “No.”
- Here’s an example of what you can put in the “Help text” field which will show up below the “To” field and provide content creators guidance on which URL to put where:
“Redirects are normally permanent. When in doubt, set to permanent, or ask a member of the {team name}.”
- The “Permanent” field will allow for content creators the option to toggle between redirect types, specifically 301 redirects and 302 redirects. The configuration above will select 301 redirect types by default, which is ideal.
- It could be best to limit access to this using role-based permissions since redirects can be complicated to manage and risky to let any content creator manage.
- Check out our article on composable redirects for a deep dive into redirect management in a headless CMS.
Up next
Let’s talk next about SEO best practices for images and Open Graph, and how to manage these within your Contenful content model.
Written by
Joshua Lohr
Senior SEO Manager
Josh is the SEO Lead at Contentful. With 15 years of experience working directly in SEO for global brands and agencies, he gets his kicks playing a variety of instruments and appreciating the nature of his adopted home in Scotland.
Rob Remington
Practice Architect
Rob Remington is a Practice Architect at Contentful, where he collaborates across all areas of the company to develop our recommended ways of building with Contentful, and ensure our technical teams have the resources they need to help our customers succeed.
Nick Switzer
Senior Solution Engineer
Nick is a technical people-person who lives for solving business problems with technology. He is a solution engineer at Contentful with 14 years of experience in the CMS space and a background in enterprise web development.
Allan White
Senior Solution Engineer
Allan White is a Senior Enterprise Solutions Engineer at Contentful. A former Contentful customer, he has 25 years of experience in design, video, UX and web development. You can catch him on Twitter or in the Contentful Slack Community.