<header><h1id="tag_Meta Description in Hugo">Meta Description in Hugo</h1></header>
<article>
<h1id="adding-meta-description-in-hugo">Adding meta description in Hugo</h1>
<p>I assume you are using Luke Smith’s theme - Lugo, if you are not, you’d have to find these files yourself (e.g. search using vscode).</p>
<h2id="setting-a-global-meta-description">Setting a global meta description</h2>
<ol>
<li>Locate your config.toml or config.yaml file</li>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#a6e22e">description</span> = <spanstyle="color:#e6db74">"The global meta description of your website"</span>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">description</span>: <spanstyle="color:#ae81ff">The global meta description of your website</span>
</span></span></code></pre></div><p>It won’t work just yet because you have update the <code>baseof.html</code> file.</p>
<h2id="updating-the-baseofhtml-file">Updating the baseof.html file</h2>
<ol>
<li>Locate baseof.html</li>
<li>Add or change the meta description line with the following</li>
</ol>
<divclass="highlight"><pretabindex="0"style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><codeclass="language-html"data-lang="html"><spanstyle="display:flex;"><span><<spanstyle="color:#f92672">meta</span><spanstyle="color:#a6e22e">name</span><spanstyle="color:#f92672">=</span><spanstyle="color:#e6db74">"description"</span><spanstyle="color:#a6e22e">content</span><spanstyle="color:#f92672">=</span><spanstyle="color:#e6db74">"{{ if .Page.Params.description }}{{ .Page.Params.description }}{{ else if .Summary}}{{ .Summary }}{{else}}{{ .Site.Params.description}}{{ end }}"</span>/>
</span></span></code></pre></div><p>And now if you start your Hugo server locally with <code>hugo serve --noHTTPCache</code> and you right click on your page -> View Page Source -> Search for the meta description tag. It should match what you left in the config file.</p>
<h2id="replacing-the-global-description-with-a-custom-one">Replacing the global description with a custom one</h2>
</span></span><spanstyle="display:flex;"><span><spanstyle="color:#f92672">description</span>: <spanstyle="color:#e6db74">"Your custom description for this page"</span>
</span></span></code></pre></div><p>Following these steps would guarantee that you have a meta description for everypage with the ability for creating a custom one whenever you need it!</p>
<divid="nextprev">
<ahref="/blog/multiple-index-pages-in-hugo/"><divid="prevart">Previous:<br>Multiple Index Pages in Hugo</div></a>
<ahref="https://vodoraslo.xyz/">Homepage</a><br><br><ahref="/index.xml"><imgsrc="/rss.svg"style="max-height:1.5em"alt="RSS Feed"title="Subscribe via RSS for updates."></a>