Section page behaved like single page

Not sure if it is a bug or just my misunderstanding.

Here is what I’m trying to do:

  1. Have all articles’ title be a link on main page, tags’ pages and section pages
  2. Title on a single page should be a simple text though.

For this to happen I used $.Scratch to store a “single” variable eq “true” (pretty much like here

So my single.html looks like this (part we’re interested in):

     {{ $.Scratch.Add "single" true }}
     {{ .Render "summary" }} 

where summary is a template with title, tags, article’s text etc.

Here is the “title part”

    {{ if $.Scratch.Get "single" }}
    <h1 class="title">{{ .Title }}</h1>
    {{ else }}
    <h2 class="title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
    {{ end }}

As you can guess the if … else part goes to li, list and summary and should determine if the title should be generated as a link or not.

For some reason this works perfectly on main page (titles are links, tags’ pages - also links and single pages - simple text). But on the .Section page - I have simple text instead of the expected link.

Any ideas?

Maybe a different partial/content view makes sense here.

You can use the following to see if you’re on a section page

<!--note that section pages pull content from content/section/ and are considered *list* pages.-->
{{if eq "Kind" "section"}}
do stuff on section page
do stuff on single page

What I don’t understand is the title of this thread: “Section page behaved like single page.”

Well, by Section page I mean the list page you are landing after clicking the appropriate link (
By “behaved like a single page” I mean - in my code I used a “single” variable (stored in $.Scratch that was set to “true” in single.html template) and from my understanding this variable should be available only in single pages (titles as text if single page and title as link on list pages). And this worked as expected for the index page, that lists all the article, tags pages, but not for the section page that is also a list page, as you mentioned.

Can you point me to a repo?

I think I’m getting hung up on your use of single, and I get the feeling you don’t need to use scratch here.

Can be replaced with

if $.IsPage

[[EDIT - left this in limbo and pressed before BEP]]
Also, just as a heads up, from the tutorial you provided:

Hugo doesn’t have {{ if .IsSinglePage }} so it’s not such a trivial task to detect single post pages.

A) This is no longer the case with Kind…and more importantly…
B) …I’m pretty confident this blog post you’re using was actually inaccurate at the time it was written, since ‘.IsPage’ has been part of Hugo for as long as I can remember.

Hey! is the repo is question, specifically “layouts/partials/header_wrapper.html” part. Yeah, I knew about $.isPage, but for sime reason was too focused on the tutorial to remember.

This, however, did not solve the problem (see header_wrapper). With this if $.isPage - all links, including those on the home page are treated all the same (so I assume index is also a Page in this case). Obviously, if I were to change this to if not $.isPage - all class='title' items will have simple text instead of links.

PS: same goes for $.IsHome function, obviously. None of the pages (including index) is treated as Home (function aways returns false)

@konart Sorry for the delay. I’ll take a look at this tomorrow after work. (I’m in Chicago, so probably around 7PM CST). Cheers.