Mediumish-go-hugo theme yelds empty home page

Greetings,

I am trying to migrate a site that was still using a ~3/4 years old version of Hugo and the Mediumish-Go-Theme to the current version of that theme, and hugo v0.92.2+extended linux/amd64, on Ubuntu 22.04 LTS.

The top pages are generated properly, as well as the single posts.

But the home page lists NO posts, and no pagination is generated, that is there are no folders like page/2, page/3 etc…

The only warnings in the log file, even with the debug and verbose options, are:

WARNING: calling IsSet with unsupported type “string” (string) will always return false.

WARNING: calling IsSet with unsupported type “invalid” () will always return false.

and warnings that the tweet shortcode will soon stop working, from rendering the 2/3 posts that use it. But as far as I can see, that function IsSet is not used in the theme at all, or anywhere else in the site source files for that matter.

What’s happening, and how to fix it?

Thanks!

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

I know that very well. But I cannot do it in this case, it’s not my decision.

adding to my previous answer:

as I said, I cannot share the actual content until the site works again. But I surely can share all the other files (theme, partials, shortcodes etc… WHAT ELSE???). Would that help?

Thanks

This one.

1 Like

a dummy repo can now be downloaded from this dropbox link:

it is only a few sample posts, and with all the identifying data stripped, but it does reproduce the problem. That is, the index.html files for each post are created, but the index page does not list them.

Thanks in advance to @jmooring and whoever else will be able to help!

Site configuration

This is a bit of a mess.

1) This is doesn’t make any sense. Remove it.

publishDir    = "/"

2) Remove this. You’ve already set the values under the taxonomies key.

[Indexes]
tag = "tag"
category = "category"

3) You’ve placed the Author key under the params key, and you have made it a string instead of a map. Remove the author key under params, and create this in the root of your configuration.

[author]
name = "me"
thumbnail = ""
description = ""

4) You have two facebook keys under params. Remove one of them.

5) The theme expects a params.index section in your site config (see theme docs). Add this, at a minimum, to the root of your site configuration.

[params.index]

6) Move language-specific custom parameters to lanuages.xx.params.

before

[languages.en]
languageCode = "en-us"
languageName = "English"
title = "my site"
topline = "fuel"

[languages.fr]
languageCode = "fr-fr"
languageName = "Français"
title = "site"
topline = "carburant"

after

[languages.en]
languageCode = "en-us"
languageName = "English"
title = "my site"
[languages.en.params]
topline = "fuel"

[languages.fr]
languageCode = "fr-fr"
languageName = "Français"
title = "site"
[languages.fr.params]
topline = "carburant"
corrected site configuration
defaultContentLanguage = "en"
baseurl = "https://mysiteexample.com/"
copyright = "© 2007-2019 me"
title = "my site"
theme = "mediumish-gohugo-theme"
summaryLength = 25
paginate = 10

[author]
name = "me"
thumbnail = ""
description = ""

[permalinks]
archives = "/:year/:month/:title/"
post = "/:year/:month/:title/"

[taxonomies]
category = "category"
tag = "tag"

[params]
dateForm = "2006-01-02"
facebook = "me"
showRelatedPost = "True"
sidebarText = "gee whiz"
name = "me"
role = "some-guy"
avatar = "img/mylogo.jpg"
email = "me@example.com"
skype = "me_skype"
date_format = "2006-01-02"
sharing = true

[params.index]

[[languages.en.menu.main]]
name = "About"
url = "/about"
weight = 1

[[languages.en.menu.main]]
name = "legal/privacy info"
url = "/legal-info"
weight = 2

[[languages.en.menu.main]]
name = "RSS"
url = "/feed.xml"
weight = 3

[languages.en]
languageCode = "en-us"
languageName = "English"
title = "my site"

  [languages.en.params]
  topline = "fuel"

[languages.fr]
languageCode = "fr-fr"
languageName = "Français"
title = "site"

  [languages.fr.params]
  topline = "carburant"

[outputFormats.RSS]
baseName = "feed"

Templates

This is a bit of a mess too.

themes/mediumish-gohugo-theme/layouts/_default/single.html

Change this:

{{if isset .Site.Params.author "name"}}
{{if isset .Site.Params.author "thumbnail"}}
{{if isset .Site.Params.author "description"}}

to this:

{{ if isset .Site.Author "name" }}
{{ if isset .Site.Author "thumbnail" }}
{{ if isset .Site.Author "description" }}

Change this:

{{if isset .Site.Params "author"}}
{{if isset .Site.Params "author_thumb"}}
    <span class="meta-footer-thumb">
    <img class="author-thumb" src="{{ .Site.Params.author_thumb | urlize | relURL  }}" alt="{{ .Site.Params.author }}">
    </span>
    <span class="author-meta">
    <span class="post-name">{{ .Site.Params.author }}</a></span><br/>
{{end}}
{{end}}

to this:

{{ if isset .Site.Author "thumbnail" }}
  <span class="meta-footer-thumb">
    <img class="author-thumb" src="{{ .Site.Author.thumbnail | urlize | relURL  }}" alt="{{ .Site.Author.name }}">
  </span>
  <span class="author-meta">
    <span class="post-name">{{ .Site.Author.name }}</span>
  </span>
  <br>
{{ end }}

Home page

You don’t have a content listing on your home page because the home page template doesn’t have any code to list the content. You’ll need to add something like:

{{ with where site.RegularPages "Type" "post" }}
  {{ range . }}
    <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
  {{ end }}
{{ end }}

Create a content page for your home page, setting draft to false:

hugo new content _index.md

General

It looks like you may have been modifying the theme templates. Don’t do that. Override them instead.

Hi @jmooring, and first of all thanks for your help!

Second, allow me a general side note: me, I did not mess with the config.toml file, nor did I modify any template. When I first downloaded that theme, years ago, I simply assigned the values I needed to the several variables, wherever they were in the sample file, copying and pasting the extra language sections as and where they were in the original config file.

Also, I did not modify any template. In other words, what’s quite messy is the template as is at themes.gohugo.io., and IMVHO themes so messy shouldn’t be listed there, ever.

This said…

about _index.md:

If I run “hugo new content _index.md” all I get is the “Failed to resolve “content” to a archetype template” error that I only found mentioned here, but without solution.

so I created a content/_index.md file like this manually:

---
title: "Welcome"
draft: false
---

but see that having it or not, and with or without the “home page” code you suggest to add, makes no difference for what follows.

About the index.html template: here, I am really confused and sorry, because I realized that something weird happened on the old server, but don’t know exactly what/when/why.

The actual file layouts/_default/index.html that works fine on the old server/hugo version I must dismiss, and paginates properly at 6 POSTS (not pages) per page is the one pasted below. With the current version of Hugo, instead:

  • if I replace the pagination code of that templated with the one you suggested I get an “extra {{end}} error”

  • with or without a _index.md file, the current version of Hugo + the mediumish theme do paginate what I need… but in the wrong place. That is, they produce (see screenshot):

    • a home page that only lists PAGES (that is the .md files inside the “content” folder), not the actual posts that are in the “content/post” subfolder!
    • but the first entry in that page (“Posts”) is a link to “posts/index.html” which does lists/paginates the actual posts. In other words, what should be in /index.html, /page/2/index.html etc… is instead in /post/index.html, /post/page/2/index.html and so on.

What now? Thanks!!

The screenshot:

The index.html template:

{{ define "header"}}
    {{- partial "_shared/navbar.html" . -}}
{{ end }}

{{ define "main" }}
    {{- partial "_shared/title.html" . -}}
    <div class="main-content">
        <!-- Posts Index
        ================================================== -->
        <section class="recent-posts">
            <div class="section-title">
                <h2><span>All Posts</span></h2>
            </div>
            <div class="row listrecent">
                {{ $post_paginator := .Paginate (.Pages) 6 }}
                {{ range $post_paginator.Pages }}
                    {{- partial "list-partials/postbox.html" . -}}
                {{end}}
            </div>
        </section>
        {{- partial "list-partials/pagination.html" $post_paginator -}}
    </div>
    {{- partial "_shared/alertbar.html" . -}}
{{ end }}

{{ define "footer"}}
    {{- partial "_shared/jumbotron.html" . -}}
    {{- partial "_shared/footer.html" . -}}
{{ end }}

@mfima We’re back to where we started…

Sorry. OK, let’s start over.

The new full dummy repo to reproduce the problem I have is downloadable from this link. config file and templates already changed according to previous suggestions from @jmooring, except “themes/mediumish-gohugo-theme-master/layouts/index.html”, for this reason: that’s the file that still works as I need with the old versions of both Hugo and the theme.

original behavior I need to preserve: to list in the home page the six newest posts, NOT pages, and links to/pagination of posts, not pages

With current Hugo and theme, instead. running “hugo server” on that repo:

  • if I use the theme’s original index.html file, I get an empty home page
  • if I use @jmooring 's code in that file (“index.html.patched”) I get this (post titles only, no grid)
    Screenshot 2023-09-27 at 07-16-48 Welcome!
  • using the index.html that works as required with old theme/hugo (“index.html.working-on-server” in the repo), instead, lists the posts with a grid, but in the wrong place, that is not in the home, but in a “/post” subfolder, as shown in the screenshots, which is not what I need:

HOME PAGE:

/post subfolder:

summing up:

  • I need help to make the home page, NOT “/post” to look like the last screenshot, grid and all, as it was before
  • I would really appreciate comments to understand what exactly went wrong, where, how. That is, was the theme just not updated to work with new version of Hugo, or did it have some bug from day one, that only became visible with new versions of hugo, or what else…

thanks