Basics
Features
Best Practices
Addon Development
Related Docs
Dark Mode

#Site Settings

General Site Settings can be controlled from the Site screen.

#Site Name

Setting the Site Name is useful when managing multiple websites as it is used in the browser tab when using MercuryCMS.

You can also use the Site Name when Templating. It's available as site.name which is useful for creating Layouts.

#Timezone

It's common to use dates throughout a website. By default, dates will be formatted in whatever timezone is set on the server MercuryCMS is running on. This is probably not what you want, so you can pick a timezone. Note that you can use Day.js within markup and style and it will respect this timezone setting as will Collection Date Fields.

#Use Trailing Slash on Page URLs

When this is enabled, the website will expect page URLs to end in slash (for example /blog/ instead of /blog). You can access this variable as site.isTrailingSlashEnabled when Templating.

It is recommended to use wrapLink() on all intra-site links to automatically add or remove the trailing slash based on this setting. For example, you can write an a tag as a(href=wrapLink('/path/to/page?category=general')) which will automatically be converted to /path/to/page/?category=general if trailing slash is enabled. You can also include a trailing slash and it will be automatically removed if the setting is not enabled.

#Trailing Slash Effects

  • Users navigating to /path/to/page will be 302 redirected to /path/to/page/ automatically. The reverse is true when this setting is disabled. Query parameters are retained during the redirect.
  • All Page paths in the Sitemap respect this setting.
  • When importing blog posts and Pages from WordPress, relative urls will either include or remove the trailing slash.
  • Redirects are dynamically changed to either include or remove the trailing slash based on this setting. For example, if the setting is on and you redirect to /some/page, it will change it to /some/page/ to avoid multiple redirect round trips. Query parameters are unaffected.
  • Automatically generated SEO tags (such as og:url) have the trailing slash appended when this setting is on. This does not affect any manually generated tags.

#Trailing Slash Notes

There are some potential problems and complications when changing this setting after the website has been completed. It is recommended you decide whether to have this setting enabled or disabled early in development.

  • Changing this setting does not affect any manually written links you have made on any pages or calculated within Vue Components. You must manually write all of these the way you want them. It is recommended that you use site.isTrailingSlashEnabled within your Components to detect this setting. Any links you haven't updated will still work, they will just involve a redirect. To avoid this problem, use wrapLink() for any intra-site links.
  • You will need to ensure all of your relative paths are linked properly. For example, if you have a page called /some/page and you linked to files.zip from that page, this would resolve to /some/files.zip. If you turn trailing slashes on, that link would resolve to /some/page/files.zip because the browser will land at /some/page/ now. You will need to manually update all of the relative paths on the site to work.
  • SEO and analytics tools consider /some/page and /some/page/ to be entirely unique locations, so work will be required to maintain data for future comparison.
  • If you have imported many blog posts from WordPress, cleaned them up, and decide later that you want to change this setting, you will either need to reimport to apply trailing slashes to all of the internal URLs and clean them up again, or manually go through each blog post and add the trailing slashes yourself.

#Style

You can apply style to every Page by adding style in the Site screen. Be careful as this is globally applied to everything. This can be useful for removing the padding and margin from body or other accessibility fixes, but you should almost always write style within Pages, Layouts, or Components.

#Script

Similarly, you can add script to every Page by adding script in the Site screen. Similarly to style, this can have a negative effect on performance and maintainability to use this with caution. You will almost always want to add script where appropriate within Pages, Layouts, or Components.

#Tags

You can globally add Tags to the <head> or <body> of every Page using the Tag System. For more information, see Tags.