Good morning everyone,
I’ll try first to describe what I’m trying to achieve:
right now I have a list on my main page that shows all pages in my website except the one named “About me”.
This is achieved with the following code and works great:
{{- range.Pages }}
{{ if ne .Name "About me" }}
<li>
{{- if .Param "datesinlist" }}<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006 Jan 02" }}</time> – {{ end -}}
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
{{- end }}
The only problem is that each page is tagged and there are list pages for all tags, with this code the “About me” page does not shows up in the “Personal” tag list page.
In order to have it showing up in the “Personal” tag list page but not in the homepage I tried the following:
{{ if and (ne .Name "About me") (ne .Site.BaseURL .Page.BaseUrl) }}
I know that .Page.BaseURL is wrong, I tried multiple variables but I never had it working correctly, I’m trying to say “If the current URL is not the base site URL (so the homepage, defined in hugo.toml)”.
Any clue on how to do this? Or maybe any other way to discriminate that I’m not thinking of?
Thanks everyone in advance for the help, if you need more info just ask.
within the range loop the dot refers to the page currently processed and so .IsHome inside will check the currently processed page and not the page you are on - which obviously will never be true for the “About me” page.