Basics
Features
Best Practices
Addon Development
Related Docs
Dark Mode

#SEO

MercuryCMS manages SEO without the need for additional plugins. It currently supports /sitemap.xml, /robots.txt, Open Graph tags, Schema.org Rich Snippets, and HTML meta tags.

Many of the SEO values for Pages are automatic, but you should manually set each Page's SEO fields. You can do this by editing the fields in the Page's SEO tab. Each of these fields supports Templating.

For example, a Page for an individual Blog Post at /blog/{{ blogPost.slug }} may have an SEO configuration like this:

Field NameValue
Page TypeArticle
Title{{ page.title }} or {{ blogPost.title }}
Images{{ blogPost.featuredImage }} or {{ blogPost.photos }}
Description{{ blogPost.excerpt }}
Article Authors{{ blogPost.authorRef.fullName }}
Article Section{{ blogPost.categoryRef.name }}
Article Tags{{ blogPost.tags }}
Article Published Time{{ blogPost.publishedAt }}
Article Modified Time{{ blogPost._updatedAt }}
Article Expiration Time

Note that for these SEO fields, MercuryCMS will automatically map them to the appropriate values during build. For example, {{ blogPost.featuredImage }} will just be a Media _id as a string, but MercuryCMS will detect this and replace it with the full image URL returned by media.getFullImageUrl().

Similarly, dates are automatically formatted when used.

To specify multiple values like for Images, Authors, or Tags, just use comma-separated values, like https://example.com/image.png, https://example.com/image2.png. If you Template in an array value, MercuryCMS will automatically convert this to the proper output.

#Favicons

You can set a favicon for the whole Site by uploading an image to the Media Library, then setting it as the Site's favicon in Site Settings. You can also set a favicon for all Pages that use a specific Layout, or set individual favicons on a Page-by-Page basis.

You can use Templating in the favicon settings for Pages and Layouts.

#Sitemap

The /sitemap.xml file is automatically generated based on the generated Pages. Configuration options for this will be available in the future.

#Robots

The /robots.txt file is automatically generated during the Build. Configuration options for this will be available in the future. You can set noindex and nofollow rules on a per Page basis.

#Canonical URLs

Canonical URLs are automatically determined for each Page during the Build. You can override a Page's Canonical URL by setting it in the Page's SEO tab. If you use a relative path, the full Site URL (for Staging or Production) will automatically be determined during the Build.

#Rich Snippets

You can set officially-supported and custom Schema.org Rich Snippets for the Site, Layouts, and Pages in their SEO tab. Each Rich Snippet type has its own unique properties.

#Redirects

Redirects are managed from the Redirects screen. At its most basic, a redirect takes a visitor that lands on a page like https://example.com/old and instructs their browser to immediately navigate to a page like https://example.com/new.

#Matching

You can create either plain or regular expression redirects. Regular expressions use JavaScript's regular expression parser, which differs from PHP's (WordPress') in some circumstances.

The From field always matches against the relative path in the URL (starting after the domain name). You should always put a relative path in the To field as well unless you're linking to an external website in which case you should include the protocol (https://) as well.

You can decide whether to match just against the path (/old) or the path including its query parameters (/old?a=1). If you match against query parameters, the path in the visitor's browser to be redirected away from will need to have the exact parameters in the exact order you type them.

Paths are always matched without the trailing slash. Even if your site has trailing slash enabled, the path will be normalized without it so you don't need to rewrite all of your redirects when changing this setting.

#Query Parameters

You can also choose what to do with the query parameters (whether you match against them or not). If you choose to keep them, any query parameters you specify in the To field will be merged with the old. For example, if the visitor types https://example.com/old?a=1 and the redirect's To field says "/new?b=2", the browser will redirect to https://example.com/new?b=2&a=1.

If you choose to replace query parameters, the original query parameters will be discarded during the redirect and the visitor will land on the To field exactly as typed. This means you can specify no query parameters or add new ones.

#Best Practices

For best practices regarding redirects, see Redirects Best Practices.