<p>Without having to use a separate Plugin this is a good basic practice on setting up basic SEO for your site.</p>

<p>First create three new fields called "<strong>seoTitle</strong>", "<strong>seoDescription</strong>" and "<strong>seoKeywords</strong>". Put these three fields in a Global group called "<strong>globalSeo</strong>".</p>

<p>In your layout template "<em>layouts/_layout.html</em>"</p>

<pre><code>    {% set seoTitle = globalSeo.seoTitle %}
    {% set seoDescription = globalSeo.seoDescription %}
    {% set seoKeywords = globalSeo.seoKeywords %}
    &lt;!DOCTYPE html&gt;
    &lt;html&gt;
        &lt;head&gt;
            &lt;title&gt;{% if title is defined %}{{ title }}{% else %}{{ seoTitle }}{% endif %}&lt;/title&gt;
            &lt;meta name="description" content="{% if description is defined %}{{ description }}{% else %}{{ seoDescription }}{% endif %}"/&gt;
            &lt;meta name="keywords" content="{{ seoKeywords }}"/&gt;

            {# You can then use the same fields for Facebook tags etc.. or create separate fields. #}
            &lt;meta property="og:title" content="{% if title is defined %}{{ title }}{% else %}{{ seoTitle }}{% endif %}"/&gt;
            &lt;meta property="og:description" content="{% if description is defined %}{{ description }}{% else %}{{ seoDescription }}{% endif %}"/&gt;
        &lt;/head&gt;
    &lt;body&gt;
</code></pre>

<p>You can now per template override these standard variables with your own for that particular page and/or template.</p>

<p>For a template:</p>

<pre><code>    {% extends "layouts/_layout" %}
    {% set title = "This is a my custom Page Title" %}
    {% set description = "This is a my custom Page Description" %}
</code></pre>

<p>For a entry:</p>

<pre><code>    {% extends "layouts/_layout" %}
    {% set title = entry.title %}
    {% set description = entry.descriptionField %}
</code></pre>

<p>.. or if you want to user to have custom control over the entry SEO as well you can always add the same "<strong>seoTitle</strong>" fields to the entry's Channel/Structure/Single and do:</p>

<pre><code>    {% extends "layouts/_layout" %}
    {% set title = entry.seoTitle %}
    {% set description = entry.seoDescription %}
</code></pre>

CC BY-SA 3.0
2014-10-08T05:58:22.870Z
Thanks for the clear explanation, naboovalley! This is how I think most do it and I would do it as well.
Ryan
CC BY-SA 4.0
2019-10-02T21:34:24.343Z
Well explained. This is just about exactly what I do, it has worked well. I set up a bunch of global defaults, including OG (open graph) stuff, and let the user override them on a per-entry basis if they want.
4midori
CC BY-SA 3.0
2014-10-08T05:55:26.980Z
2016-06-14T11:17:06.800Z
2016-06-14T11:17:06.800Z
naboovalley
<p>Completely biased answer, but check out my <a href="https://github.com/khalwat/seomatic" rel="nofollow noreferrer">SEOmatic plugin</a>.  It's pretty comprehensive, and it's free.  If you're running Craft CMS 3, the <a href="https://github.com/nystudio107/craft-seomatic" rel="nofollow noreferrer">SEOmatic plugin is available</a> for Craft CMS 3 as well (but is not free).</p>

CC BY-SA 4.0
2018-06-02T09:18:14.833Z
You're biased but to be fair it's a really good plugin so that's allowed. :)
foamcow
CC BY-SA 3.0
2016-01-08T07:18:59.213Z
2018-03-28T14:07:11.820Z
2018-03-28T14:07:11.820Z
andrew.welch
<p>Heres article on my blog about setting up basic SEO functionality for Craft CMS:</p>

<p><a href="http://craftsnippets.com/articles/basic-seo-functionality-for-craft-cms" rel="nofollow noreferrer">http://craftsnippets.com/articles/basic-seo-functionality-for-craft-cms</a></p>

<p>It presents two options:</p>

<ul>
<li>Using pure Twig code for handling <code>&lt;title&gt;</code> metatag.</li>
<li>Setting up basic SEOmetatags using <a href="https://plugins.craftcms.com/seomate" rel="nofollow noreferrer">Seomate plugin</a></li>
</ul>

CC BY-SA 4.0
2019-10-02T20:35:14.983Z
2019-10-02T20:35:14.983Z
Piotr Pogorzelski
<p>You basically have two options...</p>

<p><strong>In the world of plugins</strong>, check out the <a href="https://github.com/nystudio107/seomatic" rel="nofollow noreferrer">SEOmatic plugin</a> or <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/seo" rel="nofollow noreferrer">Sprout SEO plugin</a>. </p>

<p>On Craft 2, SEOmatic is free, Sprout SEO is $99. </p>

<p>On Craft CMS 3, the <a href="https://github.com/nystudio107/craft-seomatic" rel="nofollow noreferrer">SEOmatic plugin</a> and <a href="https://github.com/barrelstrength/craft-sprout-seo" rel="nofollow noreferrer">Sprout SEO plugin</a> are both available and $99.</p>

<p><strong>If you'd rather not use a plugin</strong>, then you're on your own to create and implement whatever fields you think you'll need. Depending on how you're approaching SEO, it could be fields like "Keywords", "Description", etc... and/or fields for the Facebook OG tags, or whatever you want! At that point, implementing your SEO fields would be nearly identical to implementing any other fields in Craft.</p>

CC BY-SA 3.0
2014-10-08T05:30:06.087Z
Ok great, thanks. Surprised this hasn't been asked before.
Ryan
CC BY-SA 3.0
2014-10-08T05:34:13.653Z
[A variation of it has...](http://craftcms.stackexchange.com/q/2753/45) from which I partially recycled this answer.
Lindsey D
CC BY-SA 3.0
2015-06-01T00:36:49.317Z
How do you deal with channel "index" or "listing" page metas? Since we can't control de fields of those pages?
jlcharette
CC BY-SA 3.0
2015-06-01T05:01:20.543Z
@JCharette I'd recommend posting a new question. Feel free to link back to this one for reference if it helps.
Lindsey D
CC BY-SA 4.0
2014-10-08T05:20:12.587Z
2018-08-03T15:03:07.757Z
2018-08-03T15:03:07.757Z
Lindsey D
<p>How do you guys handle SEO? Do you just make your own meta fields and add them in the template manually or am I missing something? I did notice there are some plugins being developed but there are sites in the wild now so it's been handled some how. Thanks!</p>

<templating><seo>
How do you handle SEO on your site?
# How do you handle SEO on your site?

(Asked by: username_0 on 2014-10-08)

How do you guys handle SEO? Do you just make your own meta fields and add them in the template manually or am I missing something? I did notice there are some plugins being developed but there are sites in the wild now so it's been handled some how. Thanks!

**Tags:** templating, seo

---

## 4 answers

### Answer by username_6 on 2014-10-08. Score: 17 | Accepted answer

You basically have two options...

**In the world of plugins**, check out the [SEOmatic plugin](https://github.com/nystudio107/seomatic) or [Sprout SEO plugin](http://sprout.barrelstrengthdesign.com/craft-plugins/seo).

On Craft 2, SEOmatic is free, Sprout SEO is $99.

On Craft CMS 3, the [SEOmatic plugin](https://github.com/nystudio107/craft-seomatic) and [Sprout SEO plugin](https://github.com/barrelstrength/craft-sprout-seo) are both available and $99.

**If you'd rather not use a plugin**, then you're on your own to create and implement whatever fields you think you'll need. Depending on how you're approaching SEO, it could be fields like "Keywords", "Description", etc... and/or fields for the Facebook OG tags, or whatever you want! At that point, implementing your SEO fields would be nearly identical to implementing any other fields in Craft.

> **Comments:**
> **username_0**: Ok great, thanks. Surprised this hasn't been asked before.  
> **username_6**: [A variation of it has...](http://craftcms.stackexchange.com/q/2753/45) from which I partially recycled this answer.  
> **username_7**: How do you deal with channel "index" or "listing" page metas? Since we can't control de fields of those pages?  
> **username_6**: @JCharette I'd recommend posting a new question. Feel free to link back to this one for reference if it helps.  

---

### Answer by username_1 on 2014-10-08. Score: 34

Without having to use a separate Plugin this is a good basic practice on setting up basic SEO for your site.
First create three new fields called "seoTitle", "seoDescription" and "seoKeywords". Put these three fields in a Global group called "globalSeo".
In your layout template "layouts/_layout.html"
    {% set seoTitle = globalSeo.seoTitle %}
    {% set seoDescription = globalSeo.seoDescription %}
    {% set seoKeywords = globalSeo.seoKeywords %}
    
    
        
            {% if title is defined %}{{ title }}{% else %}{{ seoTitle }}{% endif %}
            
            

            {# You can then use the same fields for Facebook tags etc.. or create separate fields. #}
            
            
        
    

You can now per template override these standard variables with your own for that particular page and/or template.
For a template:
    {% extends "layouts/_layout" %}
    {% set title = "This is a my custom Page Title" %}
    {% set description = "This is a my custom Page Description" %}

For a entry:
    {% extends "layouts/_layout" %}
    {% set title = entry.title %}
    {% set description = entry.descriptionField %}

.. or if you want to user to have custom control over the entry SEO as well you can always add the same "seoTitle" fields to the entry's Channel/Structure/Single and do:
    {% extends "layouts/_layout" %}
    {% set title = entry.seoTitle %}
    {% set description = entry.seoDescription %}

> **Comments:**
> **username_0**: Thanks for the clear explanation, naboovalley! This is how I think most do it and I would do it as well.  
> **username_2**: Well explained. This is just about exactly what I do, it has worked well. I set up a bunch of global defaults, including OG (open graph) stuff, and let the user override them on a per-entry basis if they want.  

---

### Answer by username_3 on 2016-01-08. Score: 14

Completely biased answer, but check out my [SEOmatic plugin](https://github.com/khalwat/seomatic). It's pretty comprehensive, and it's free. If you're running Craft CMS 3, the [SEOmatic plugin is available](https://github.com/nystudio107/craft-seomatic) for Craft CMS 3 as well (but is not free).

> **Comments:**
> **username_4**: You're biased but to be fair it's a really good plugin so that's allowed. :)  

---

### Answer by username_5 on 2019-10-02. Score: 0

Heres article on my blog about setting up basic SEO functionality for Craft CMS:

<http://craftsnippets.com/articles/basic-seo-functionality-for-craft-cms>

It presents two options:

* Using pure Twig code for handling  metatag.
* Setting up basic SEOmetatags using [Seomate plugin](https://plugins.craftcms.com/seomate)


---

