/content/about.md doesn't work with /layouts/_default/about/single.html

Hi friends,

I made a layout for a specific page in
/layouts/_default/about/single.html

The specific page is
/content/about.md

I added type and layout variable in frontmatter though it’s not working.
Can you please address me what did I do wrong? I don’t want to show date/time on about page.

about.md looks like this

---
title: test
layout: "about"
type: "about"
---

asdgdhfjgkhfd

/layouts/_default/about/single.html
looks like this

{{ define "main" }}
	<main>
		<article>
			<h1>{{ .Title }}</h1>
			<div>
				{{ .Content }}
			</div>
		</article>
	</main>
{{ partial "sidebar.html" . }}
{{ end }}

/layouts/_default/single.html
looks like this (and I thought removing <time> would simply work with about.md)

{{ define "main" }}
	<main>
		<article>
			<h1>{{ .Title }}</h1>
			<b><time>{{ .Date.Format (default "2006-01-02 15:04:05" .Site.Params.dateFmt) }}</time></b>
		       {{ range .Params.tags }}
		           <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
        	       {{ end }}

			<div>
				{{ .Content }}
			</div>
		</article>
	</main>
{{ partial "sidebar.html" . }}
{{ end }}

the result page looks looks like this
https://kimchiest.com/about
thanks for your help! :sunny:

I believe you mixed two things up and am pretty sure /layouts/_default/about/single.html should be either /layouts/_default/about.html with layout: about in your frontmatter or it has to be at /layouts/about/single.html.

1 Like

The .Type of any page at the root of your content directory will be page, so your options are:

Path Frontmatter
layouts/_default/about.html layout = "about"
layouts/page/about.html layout = "about"
4 Likes

Thank you so much!

I deleted unnecessary directory /about/ and created layouts/_default/about.html. It works great. :blush::blush::blush:

Both replies are solutions and I couldn’t choose both of them so I’m leaving it as it is.

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