<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hugo on Abel G. Vidal</title><link>https://abelgvidal.com/tags/hugo/</link><description>Recent content in Hugo on Abel G. Vidal</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 13 Apr 2025 20:02:54 +0100</lastBuildDate><atom:link href="https://abelgvidal.com/tags/hugo/index.xml" rel="self" type="application/rss+xml"/><item><title>Hugo: filter post by tag</title><link>https://abelgvidal.com/posts/filter-tags-in-hugo-template/</link><pubDate>Sun, 13 Apr 2025 20:02:54 +0100</pubDate><guid>https://abelgvidal.com/posts/filter-tags-in-hugo-template/</guid><description>&lt;p>I wanted to stop showing in the frontpage of this blog powered by (&lt;a href="https://gohugo.io/">Hugo&lt;/a>) the posts tagged as &amp;ldquo;TIL&amp;rdquo; or &amp;ldquo;IWL&amp;rdquo;.&lt;/p>
&lt;p>My theme template is&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-go-html-template" data-lang="go-html-template">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#57606a">{{&lt;/span>&lt;span style="color:#fff"> &lt;/span>&lt;span style="color:#1f2328">$blogPages&lt;/span>&lt;span style="color:#fff"> &lt;/span>&lt;span style="color:#0550ae">:=&lt;/span>&lt;span style="color:#fff"> &lt;/span>&lt;span style="color:#1f2328">where&lt;/span>&lt;span style="color:#fff"> &lt;/span>&lt;span style="color:#1f2328">.Site.RegularPages.ByDate.Reverse&lt;/span>&lt;span style="color:#fff"> &lt;/span>&lt;span style="color:#0a3069">&amp;#34;.Type&amp;#34;&lt;/span>&lt;span style="color:#fff"> &lt;/span>&lt;span style="color:#0a3069">&amp;#34;in&amp;#34;&lt;/span>&lt;span style="color:#fff"> &lt;/span>&lt;span style="color:#1f2328">.Site.Params.mainSections&lt;/span>&lt;span style="color:#fff"> &lt;/span>&lt;span style="color:#57606a">}}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>I tried with &amp;ldquo;intersect&amp;rdquo; and &amp;ldquo;where&amp;rdquo; but it did not work, not sure if it is because my Hugo version is old but, anyway, I was too lazy to upgrade Hugo (and adapt all templates, breaking changes, etc) so this simple code made my day:&lt;/p></description></item></channel></rss>