A short guide to SEO in Contao | qzminski Blog

A short guide to SEO in Contao

In this short article I will go through the basic options that Contao offers you to improve the Search Engine Optimization of your website.

Settings

The Contao settings provide three options that are related to SEO. You can specify the URL suffix, the part that is added to the end of the URL, for example .html or .php.

The checked “Rewrite URLs” option makes the index.php disappear from the URL. Before checking this option, ensure that you have Apache’s mod_rewrite module enabled on your server. Additionally, you need to rename .htaccess.default to .htaccess.

Furthermore, if you don’t like the aliases in the web address, you can turn them off by checking “Disable page alias usage”.

Note that if you have changed the URL suffix, you also need to modify the .htaccess file. For example, if you replaced .html with .asd, edit it as follows:

RewriteRule .*\.asd$ index.php [L]

If you empty the “URL suffix” field, change .htaccess respectively:

RewriteRule .* index.php [L]

Then your url will look like either www.domain.com/academy.php or www.domain.com/academy.

Page title & description

For every regular page in Contao you can set its name, alias, title, description and robots behavior.

The page name is displayed in navigation, and, if the title is not set, in browser window bar. However, when the title is set, it is displayed in browser window bar and in the navigation as a “title” attribute of a link. That means if you hover an unactive navigation position, a bubble with page title will appear.

You can also instruct search engines what to do with a page, by selecting a proper option in the dropdown menu “Robots tag”:

NOINDEX – prevents a page from being indexed.

INDEX – tells the search engine robots to index the page and to include your page within they search directory.

FOLLOW – tells the search engines that you want t heir robot to follow any links that are found on that page.

NOFOLLOW – prevents links of the page from being crawled.

The above info comes from globinch.com.

Page title, as well as description, is visible in the search results of Google or Yahoo.

Keywords

The keywords are set in the options of each article. If there are multiple articles on a single page, they are all joined and put into <meta> tags.

"The Academy" page keywords set in the first article

"The Academy" page keywords set in the second article

Now the page will render with changed code:

The source code of "The Academy" page

The mechanism of keywords is simple and works like this:

// A regular page "academy.html"

foreach ($arrArticles as $article)
{
  $strKeywords .= $article['keywords'];
  return $strKeywords;
}

Sitemap

The sitemap.xml file lists the structure of your site and its pages. It gives search engine crawlers an idea of where things are on your site.

This is how the Sitemap.xml file interacts between a search engine and your website. Image by Six Revisions.

The sitemap of your website can be automatically generated by Contao. Simply go to the website root and in “Xml sitemap” section check the “Create an XML sitemap” box. Then provide a file name that will be generated in the root folder.

Contao will automatically generate a sitemap.xml for you

To sum up

Before launching your new website, make sure you checked things in this list, so your website can be visible in the search engines:

  1. Ensure you got “Rewrite URLs” turned on.
  2. Make sure all pages got titles and descriptions.
  3. Verify the keywords of all articles.
  4. Generate the sitemap of your website.

I hope I haven’t missed anything :roll:


About Author

Kamil Kuzminski

Hi! I'm a webdeveloper from Olsztyn, Poland. I'm the manager of Contao (fka TYPOlight) polish support website and community. I work mainly as a freelancer for private clients or various agencies.





Comments

  1. Bright nation October 18th

    Comment Arrow

    Hi Kamil,

    thank you for this post. I just wanted to highlight quickly, do you know why the google sitemap wouldn’t be built as default on every site? Will post on the forums as well.

    Thanks again,
    Antonio


Add Yours

  • Author Avatar

    YOU


Comment Arrow