Configuration
Target group: Developers, Integrators
Content on this page
Subpages
Site sets
Include the site set "SEO Sitemap" via the site set in the site configuration or the custom site package's site set.
Settings for the included set can be adjusted in the Settings editor.
This will change your site configuration file as follows:
base: 'https://example.com/'
rootPageId: 1
dependencies:
- typo3/fluid-styled-content-css
+ - typo3/seo-sitemap
If your site has a custom site package, you can also add the "SEO Sitemap" set as dependency in your site's configuration:
TypoScript Settings
There are a couple of TypoScript settings that can influence the output regarding SEO.
Site configuration
The configuration of sites is done with the Site Management > Sites module. As the settings for your websites are important for SEO purposes as well, please make sure you check the following fields.
To get more in depth information about the site handling please refer to the Site handling docs.
Entry Point
Please ensure, that you have configured your sites so that they all have an entry point. This is used for properly generating the canonical tags, for example.
Warning
Please be aware that for SEO purposes it is best practice to use a fully qualified domain name (for example:
https://
).
Therefore TYPO3 requires to enter such a full domain name for your Entry Point
configuration to support
SEO enhancements as intended.
Languages
Ensure, that you setup the site languages correctly. All languages should have the right information in the Locale and other language-dependant input fields. When set correctly, TYPO3 will automatically connect your page in the different languages so that search engines understand their relations. This it to ensure that the search engine knows which page to show when someone is searching in a specific language.
Hint
Even if you have only one language, make sure all language input fields in the Locale tab are also set correctly. Giving wrong information to search engines will not help you to rank higher.
See Adding Languages for more details.
Error Handling
Although TYPO3 will respond with a HTTP status code 404
when a page is not found, it is best practice to
have a proper content telling the user that the page they requested is not available. This can guide them to another
page or for example to a search function of your website.
See Error handling for more details.
robots.txt
The robots.
file is a powerful feature and should be used with care. It will deny or allow search engines to access your pages.
By blocking access to your pages, search engines won't crawl these pages. You should make sure that this will not
prevent the search engines from finding important pages.
It is best practice to keep your robots.txt as clean as possible. An example of a minimal version of your robots.txt:
# This space intentionally left blank. Only add entries when you know how powerful the robots.txt is.
User-agent: *
On Static routes you can find more details on how to create a static route that will show
this information when visiting https://
.
When you want to disallow specific URLs, you can use the Index this page option in the backend or set the robot HTTP
header X-
manually.
Static Routes and redirects
Having correct redirects and choosing the appropriate status code is a very important part of SEO.
It is possible to manage redirects via the TYPO3 redirects extension, but it is not the only option and from a performance perspective it may not be the best solution. Please also see Performance in the EXT:redirects documentation.
Tags
Hreflang link-tags
The generation of the <link rel="alternate" hreflang="" href="" />
tags is done automatically if the page is available in other languages.
This feature should work correctly in almost all cases.
TYPO3 is using PSR-14 events to handle the generation of those hreflang
link-tags.
If, for some reason, you would like to alter or remove the automatically generated
tags, you can register your own EventListener. This EventListener should listen
to the \TYPO3\
event. Just make
sure your EventListener is ordered after the \TYPO3\
listener.
More information how to work with EventListeners can be found in the documentation of Event dispatcher (PSR-14 events)
Canonical Tag
Just like the hreflang
link-tags, the <link rel="canonical" href="" />
link-tag is also generated automatically.
If you have a specific edge case, and you don't want TYPO3 to render the tag, you can disable rendering completely.
You can put this line in the ext_
of an extension and also make sure your extension is loaded after EXT:
:
unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags']['canonical']);
Working links
Links in your website are quite important. You can use third party applications to check all your links, but you can
also use the core extension EXT:
to ensure all the links in your site are working as expected.
Please check the documentation of TYPO3 Link Validator .
TypoScript examples
This section will provide you with examples on how to configure several behaviours in the frontend.
Setting missing OpenGraph meta tags
Most of the OpenGraph meta tags are rendered automatically when EXT:
is installed. If you
want to add meta tags properties such as og:
, og:
and og:
, you can use
TypoScript code like this:
page {
meta {
og:site_name = YOUR_SITE_NAME
og:site_name.attribute = property
og:locale = en_US
og:locale.attribute = property
og:locale:alternate {
attribute = property
value {
1 = de_DE
}
}
}
}
Setting fallbacks for meta tags
As you can see on TypoScript and PHP the tags are first
set by PHP and after that the TypoScript config is handled. As EXT:
is only
adding the meta tags for the SEO
and Social media
fields (if they are filled in
the page properties), you have some possibilities to add fallbacks.
Because EXT:
is handling the tags in PHP-scope, you are able to add those
fallbacks using TypoScript. You can add those tags with TypoScript and those will
only be rendered when EXT:
has not rendered them.
An example to set a fallback description
and og:
:
page {
meta {
description = Your fallback description tag
og:description = Your fallback OG:description tag
}
}
Hint
Having fallbacks for those fields seems to be a good idea, but please consider if you really want those fallbacks. Those meta tags should tell search engines or social networks, what the page is about. Social networks also have their own fallbacks. Setting a fallback for og:description to the description field might not be needed as the social networks have such a fallback as well. So please consider if you want to add those tags if they do not bring additional valuable information.
Setting fallbacks for og:image and twitter:image
If you want to have a fallback og:
or twitter:
, you can use this little snippet.
page {
meta {
og:image.stdWrap.cObject = TEXT
og:image.stdWrap.cObject {
if.isFalse.field = og_image
stdWrap.typolink {
parameter.stdWrap.cObject = IMG_RESOURCE
parameter.stdWrap.cObject.file = EXT:your_extension/Resources/Public/Backend/OgImage.svg
returnLast = url
forceAbsoluteUrl = 1
}
}
twitter:image.stdWrap.cObject = TEXT
twitter:image.stdWrap.cObject {
if.isFalse.field = twitter_image
stdWrap.typolink {
parameter.stdWrap.cObject = IMG_RESOURCE
parameter.stdWrap.cObject.file = EXT:your_extension/Resources/Public/Backend/TwitterCardImage.svg
returnLast = url
forceAbsoluteUrl = 1
}
}
}
}
More information about the Meta Tag API can be found on:
- PHP MetaTag API
- TypoScript Properties
Setting defaults for the author on meta tags
This example shows how to set a default author based on the TypoScript constant {$my.
:
page {
meta {
author = {$my.default.author}
}
}