Automad takes care of the technical side of search engine optimization and social sharing. Every page gets meta tags, Open Graph tags and a generated preview image, and the site provides a sitemap.xml and a robots.txt file. All of this is handled by Automad itself, independent of the installed theme, and works without any setup.
This page explains what Automad generates and how it works. To customize titles, descriptions, preview images and icons in the dashboard, see Open Graph & Favicons in the User Guide.
Meta Tags
When a page is rendered, Automad adds the following tags to the <head> section of the HTML:
| Tag | Content |
|---|---|
<title> | The page title followed by the site name, for example About | My Site. |
description | The first paragraph of the page, shortened to 150 characters. |
og:title, og:description | The same title and description for social platforms and messaging apps. |
og:image | The Open Graph image of the page. |
og:url, canonical | The URL of the current page. |
og:type | Always website. |
twitter:card | Always summary_large_image, so that the preview image is displayed in full size. |
| Icons | Links to the favicons and touch icons, if they exist. |
| RSS | A link to the RSS feed, if the feed is enabled. |
hreflang | The language of the page on multilingual sites. |
The title and the description can be overridden for every page using the Meta Title and Meta Description fields, as described in Page Metadata.
Open Graph Images
Social platforms and messaging apps display the og:image as a preview when a link to your site is shared. Unless a custom image is selected, Automad generates such an image for every page. It is a PNG file of 1280 × 640 pixels that shows the site name, the page title, the domain and an optional logo on a solid background.
Generated images are stored in the cache/images directory and reused on later requests. A new image is only created when one of its ingredients changes, such as the title, the site name, the colors or the logo. The colors, the logo, the displayed title and custom images can all be changed in the dashboard, as described in Open Graph Images.
Sitemap
The sitemap and the robots.txt are not stored as files on disk. Instead, both are created dynamically whenever they are requested. They therefore always reflect the current state of your pages and use the domain of the actual request, without having to be rebuilt or updated.
The sitemap is available at /sitemap.xml and lists the URLs of all pages that are publicly accessible. Pages that are only hidden from the navigation are included as well, since visitors can still open them. Private pages and pages that redirect to another URL are left out.
Every page that you add, publish, move or delete is reflected in the sitemap with the next request. You can submit the URL of the sitemap directly to search engines, for example using the Google Search Console.
Robots.txt
The robots.txt file tells search engines which parts of a site they may crawl. Automad excludes the dashboard and its internal API, allows everything else and points crawlers to the sitemap. For a site that runs on https://example.com, it looks as follows:
User-agent: *
Disallow: /dashboard/*
Disallow: /_api/*
Allow: /
Sitemap: https://example.com/sitemap.xml
Note that search engines only look for robots.txt at the root of a domain. When Automad is installed in a subdirectory, the file is still generated, but crawlers will not pick it up.
Base URL
By default, all URLs in the sitemap and the robots.txt use the protocol and domain of the current request. When your site runs behind a proxy, or when you want to pin these URLs to a single domain, set the AM_BASE_SITEMAP option in the configuration file:
<?php return <<< 'JSON'
{
"AM_BASE_SITEMAP": "https://example.com"
}
JSON;