<p>The Title field will be a part of every entry 90% of the time ('Singles' don't need a Title).</p>

<p>To add a custom field in Craft:
<strong>Settings</strong> > <strong>Fields</strong> > (create a field)</p>

<p>To add the new field to a content type:
<strong>Settings</strong> > <strong>Sections</strong> > (click the "Edit content-type" link to the right) > (drag your new field into the blue box) > hit Save.</p>

<hr>

<p>I like to create a separate custom field for each e.g. "<strong>Meta Title</strong>" and "<strong>Meta Description</strong>" - I then add these to a separate tab within a given <strong>content-type</strong>. (see attached)</p>

<p><img src="https://i.sstatic.net/FEMyZ.png" alt="SEO fields"></p>

<p>Normally, I leave the SEO fields optional.</p>

<p>Then, in _layout.html:</p>

<pre><code>&lt;title&gt;{% block entryMetaTitle %}{% endblock %}{{ siteName }}&lt;/title&gt;
&lt;meta name="description" content="{% block entryMetaDescription %}{% endblock %}"&gt;
</code></pre>

<p>The block tags inherit content from an individual template e.g. <strong>domain.com/news/news-article-slug</strong>, will make use of a single-entry template e.g. <strong>craft/templates/news/_entry.html</strong> which will contain:</p>

<pre><code>{% extends "_layouts/_layout" %}

{% block entryMetaTitle %}{% if entry.metaTitle %}{{ entry.metaTitle}} | {% elseif entry.title %}{{ entry.title}} | {% endif %} News | {% endblock %}
{% block entryMetaDescription %}{% if entry.metaDescription %}{{ entry.metaDescription}}{% else %}{{entry.summaryText}}{% endif %}{% endblock %}

{% block content %}
... 
{% endblock %}
</code></pre>

<p>The above will display any content which the client decides to add to the custom fields, OR if nothing has been added the template will display the entry <strong>Title</strong> + <strong>Summary Text</strong> (in this case)</p>

<p>This post might also help you to define your own approach: <a href="https://craftcms.stackexchange.com/questions/2986/how-do-you-handle-seo-on-your-site">How do you handle SEO on your site?</a></p>

CC BY-SA 3.0
2016-02-17T08:55:09.747Z
Thanks for the quick answer. Apologies for taking so long to come back. Been away. I'm guessing the contents of the `entryMetaDescription` block also work if it was just placed into _layout.html? So, for example: `<title>{% if entry.metaTitle %}{{ entry.metaTitle }} | {% elseif entry.title %}{{ entry.title }} | {% endif %}{{ siteName }}</title>`
ADigitalMark
CC BY-SA 3.0
2016-02-18T10:29:12.030Z
It would, however I prefer having it in individual templates as it allows a little more control in cases where the the custom-field names might differ or not exist at all for a given content-type.
Matt P
CC BY-SA 3.0
2016-02-18T13:08:51.943Z
... and, additionally, if there's multiple channels, you might want to display the name of that channel as part of the title, something that wouldn't be so easily achieved with my last comment ...
ADigitalMark
CC BY-SA 3.0
2016-02-12T17:05:30.887Z
2016-02-12T17:05:30.887Z
2017-04-13T12:50:59.930Z
Matt P
<p>I'd really like some help with Craft CMS, that's probably a very basic thing to achieve, but I've so far got no idea how to. In another post about SEO, I saw something like this written:</p>

<pre><code>&lt;meta name="title" content="{% if title is defined %}{{ title }}{% endif %}"&gt;
&lt;meta name="description" content="{% if description is defined %}{{ description }}{% endif %}"&gt;
</code></pre>

<p>The first part, regarding the title, is in the _layout.html by default. And, in the CMS, above each entry's body, I have managed to display a box for the user to enter a title.</p>

<p>BUT, were I to add the second part, regarding the description, I have so far been unable to find out how in the CMS, I can add a box for the user to enter a description.</p>

<p>Thanks in advance for any help that anyone can provide.</p>

<p>With kind regards,</p>

<p>Mark</p>

<templating><meta>
How do I define an entry's META description?
# How do I define an entry's META description?

(Asked by: username_0 on 2016-02-12)

I'd really like some help with Craft CMS, that's probably a very basic thing to achieve, but I've so far got no idea how to. In another post about SEO, I saw something like this written:



The first part, regarding the title, is in the _layout.html by default. And, in the CMS, above each entry's body, I have managed to display a box for the user to enter a title.
BUT, were I to add the second part, regarding the description, I have so far been unable to find out how in the CMS, I can add a box for the user to enter a description.
Thanks in advance for any help that anyone can provide.
With kind regards,
Mark

**Tags:** templating, meta

---

## 1 answers

### Answer by username_1 on 2016-02-12. Score: 5 | Accepted answer

The Title field will be a part of every entry 90% of the time ('Singles' don't need a Title).
To add a custom field in Craft:
Settings > Fields > (create a field)
To add the new field to a content type:
Settings > Sections > (click the "Edit content-type" link to the right) > (drag your new field into the blue box) > hit Save.

I like to create a separate custom field for each e.g. "Meta Title" and "Meta Description" - I then add these to a separate tab within a given content-type. (see attached)

Normally, I leave the SEO fields optional.
Then, in _layout.html:
{% block entryMetaTitle %}{% endblock %}{{ siteName }}


The block tags inherit content from an individual template e.g. domain.com/news/news-article-slug, will make use of a single-entry template e.g. craft/templates/news/_entry.html which will contain:
{% extends "_layouts/_layout" %}

{% block entryMetaTitle %}{% if entry.metaTitle %}{{ entry.metaTitle}} | {% elseif entry.title %}{{ entry.title}} | {% endif %} News | {% endblock %}
{% block entryMetaDescription %}{% if entry.metaDescription %}{{ entry.metaDescription}}{% else %}{{entry.summaryText}}{% endif %}{% endblock %}

{% block content %}
... 
{% endblock %}

The above will display any content which the client decides to add to the custom fields, OR if nothing has been added the template will display the entry Title + Summary Text (in this case)
This post might also help you to define your own approach: How do you handle SEO on your site?

> **Comments:**
> **username_0**: Thanks for the quick answer. Apologies for taking so long to come back. Been away. I'm guessing the contents of the `entryMetaDescription` block also work if it was just placed into _layout.html? So, for example: `<title>{% if entry.metaTitle %}{{ entry.metaTitle }} | {% elseif entry.title %}{{ entry.title }} | {% endif %}{{ siteName }}</title>`  
> **username_1**: It would, however I prefer having it in individual templates as it allows a little more control in cases where the the custom-field names might differ or not exist at all for a given content-type.  
> **username_0**: ... and, additionally, if there's multiple channels, you might want to display the name of that channel as part of the title, something that wouldn't be so easily achieved with my last comment ...  

---

