# mod\_seo

Source: https://zotonic.com/docs/1535/mod_seo

URI: https://zotonic.com/id/1535

Language: en



Adds basic search engine optimization to the base templates and provides an admin interface for configuring SEO options and Google Universal Analytics.

SEO data
--------

mod\_seo adds metadata to your pages to improve your website’s display and ranking in search engine (e.g. Google) results. This metadata includes [structured data](https://developers.google.com/search/docs/guides/intro-structured-data):

Google uses structured data that it finds on the web to understand the content of the page, as well as to gather information about the web and the world in general.

Following Google’s recommendations, mod\_seo adds data in the [Schema.org](https://schema.org) vocabulary, using the JSON-LD format. This enables [search features](https://developers.google.com/search/docs/guides/search-features) such as rich results, carousels and the sitelinks searchbox.

::: {.note title="Tip"}
If you wish to alter the structured data, you can do so by overriding the `schema_org/schema.*.tpl` templates. When you do so, make sure to validate your changes with Google’s [structured data testing tool](https://search.google.com/structured-data/testing-tool).
:::

Configuration
-------------

### Disable search engine indexing

To prevent search engines from indexing a page, check the ‘Ask Google not to index this page’ checkbox in the admin. Programmatically, you can set the `seo_noindex` flag on a resource to do the same.

Generated pages can pass the `seo_noindex` template variable. By default this emits `noindex,nofollow`. Pass `seo_follow` as well for navigation or search pages whose linked content should remain discoverable:

```django
{% extends "base.tpl" seo_noindex seo_follow %}
```

The site-wide noindex setting always emits `noindex,nofollow`, regardless of these page-level variables.

To disable indexing for the site as a whole, go to Modules > SEO in the Admin (`https://yoursite/admin/seo`) and tick the ‘Exclude this site from search engines’ checkbox.

### Google Analytics

To enable [Google Universal Analytics](https://support.google.com/analytics/answer/2790010) tracking on your Zotonic website, go to `https://yoursite/admin/seo` in your browser and enter your Google Analytics tracking code.

Zotonic does not automatically supports the [User ID Analytics feature](https://support.google.com/analytics/answer/3123662). You have to [enable User ID](https://support.google.com/analytics/answer/3123666) in your Analytics account and override the `_ga_params.tpl` template to add the parameter:

```django
{#
    Override this template to provide extra Google Analytics parameters.
    See https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
#}
{
    {% if m.acl.user %}
        "userId": "{{ m.acl.user|escapejs }}",
    {% endif %}
}
```

### Extra parameters

If you wish to add extra [Google Analytics parameters](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference), override the `_ga_params.tpl` file and add the parameters:

```django
{#
    Override this template to provide extra Google Analytics parameters.
    See https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
#}
{
    {% if m.acl.user %}
        "userId": "{{ m.acl.user|escapejs }}",
    {% endif %}
    "sessionControl": "start"
}
```

SEO module that adds metadata generation and admin SEO configuration options.

Accepted Events
---------------

This module handles the following notifier callbacks:

- `observe_admin_menu`: Contribute module entries to the admin menu tree.
- `observe_content_security_header`: Ensure that the Google Tag manager works correctly with our CSP using `m_config:get_value`.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1535?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1535?language=en>)
