Title specificity help

Hi, everyone. I have a very specific problem that I need to fix. I have to stick the title of all pages be it article title or section title in the same place in the header. I can detect when the title is under all situations using this code

{{ if .IsHome }}
    <h1></h1>
{{ else if .IsSection }}
    <h1></h1>
{{ else}}
    <time>{{ .Date.Format "January 2, 2006" }}</time>	
    <h1></h1>
{{ end}}

This is my current structure

content/
    articles/
        _index.md
        art1.md
    stacks/ // .IsSection or .IsNode because of _index.md
        _index.md 
        art1.md // .IsPage
    _index.md //.IsHome
    about.md // here is the problem
    contact.md // here is the problem

and this is my page structure

partial head
partial header //title is in here
define main
    content
end
partial footer

The problem I have is that I don’t know what to do to remove the date from about.md and contact.md. They appear the same as every other page, and I know hugo doesn’t make a difference between pages, but still one is part of a section and the other two are free of every section. The idea is that I want to have dates added to pages that theoretically are posts.

Is there any way of doing that?

I know this sounds mad but I’m using the header as like the engine of the site. and everything is present there.

Thank you so much for the help, I’m at this for two weeks now.

{{ if and .IsPage (not (eq .Type "page")) }}
  {{ $datetime := .Date.Format "2006-01-02T15:04:05-07:00" }}
  {{ $date := .Date.Format "January 2, 2006" }}
  <time datetime="{{ $datetime }}">{{ $date }}</time>
{{ end }}
<h1>{{ .Title }}</h1>

Anything in the root of the content directory has .Type = page

content/
├── articles/
│   ├── art1.md    <-- .Type = articles
│   └── _index.md  <-- .Type = articles
├── stacks/
│   ├── _index.md  <-- .Type = stacks
│   └── stack1.md  <-- .Type = stacks
├── about.md       <-- .Type = page
├── contact.md     <-- .Type = page
└── _index.md      <-- .Type = page

Thank you! Thank you, so much!!

I used it like this:

        {{ if .IsHome }}
			<h1>
			<p></p>
			<p></p>
            </h1>
			<div class="navigation">
			</div>
		{{ else if .IsSection }}
			<h1 class="title">{{ .Title }}</h1>
		{{ else}}
			{{ if and .IsPage (not (eq .Type "page")) }}
				{{ $datetime := .Date.Format "2006-01-02T15:04:05-07:00" }}
				{{ $date := .Date.Format "January 2, 2006" }}
				<time datetime="{{ $datetime }}">{{ $date }}</time>
				<h1>{{ .Title }}</h1>
			{{ end }}
			{{ if and .IsPage (eq .Type "page") }}
				<h1 class="title">{{ .Title }}</h1>
			{{ end }}
		{{ end}}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.