Blog list Not Working & Pages Show the 404 Page

Hello.

I am trying to get all of my website’s sections to show up before I style them. But I keep getting the same issues. My site is at https://kaliriu.com/

These are the problems I’ve encountered:

  1. Index/Homepage works fine, but my sections Contact and Services show the 404 page.
  2. The list of blogs are not showing up

Here is my code:

Thank you

Read this:
https://gohugo.io/templates/base/

You have not defined “main” within either list or single.

Your configuration file is a bit of a mess too. Move the Netlify parameters to a netlify.toml file.

I did, or is this not what you mean?
Ex:
{{ define “main” }}

{{ with .Params }}

<main id="main" class="b-basic-page__background">

  <div class="b-basic-page__container">

    <h1 class="b-basic-page__title">{{ .title }}</h1>

  </div>

</main>

{{ end }}

{{ end }}

Let me know when you have pushed the changes to your repository.

They’re not changes. They’ve been there from the start

You have defined main in:

  • layouts/blog/list.html
  • layouts/blog/single.html
  • layouts/contact/single.html
  • layouts/services/single.html

You have not defined main in:

  • layouts/_default/list.html
  • layouts/_default/single.html

Done! I’ve defined main where it was missing. Thank you. Please let me know if you find the fix, I’ve tried everything I know

Configuration

Your config file contains many errors. Here’s one that works:

config.toml
baseURL = 'https://kaliriu.com/'
title = 'Kaliriu'

defaultContentLanguage = 'en'
defaultContentLanguageInSubdir = true

[languages.en]
contentDir = 'content/english'
description = 'Kaliriu in English'
languageCode = 'en-US'
languageName = 'English'
weight = 1

[[languages.en.menu.main]]
name = 'Home'
pageRef = '/'
weight = 1

[[languages.en.menu.main]]
name = 'Services'
pageRef = 'services'
weight = 2

[[languages.en.menu.main]]
name = 'Contact'
pageRef = 'contact'
weight = 3

[languages.es]
contentDir = 'content/spanish'
description = 'Kaliriu en Español'
languageCode = 'es-ES'
languageName = 'Español'
weight = 2

[[languages.es.menu.main]]
name = 'Inicio'
pageRef = '/'
weight = 1

[[languages.es.menu.main]]
name = 'Servicios'
pageRef = 'services'
weight = 1

[[languages.es.menu.main]]
name = 'Contacto'
pageRef = 'contact'
weight = 2

Layouts

The layouts in layouts/contact and layouts/services will never be used. See:
https://gohugo.io/templates/lookup-order

If you want to create a unique template for the contact page, see:
https://discourse.gohugo.io/t/something-is-escaping-me-cannot-pick-up-the-layout/36660/2

Context

In layouts/blog/list.html you wrap everything with:

{{ with .Params }}
   ...
{{ end }}

The with statement rebinds the context, so everything you have inside is broken. See:
https://www.regisphilibert.com/blog/2018/02/hugo-the-scope-the-context-and-the-dot/

Next Step

Perhaps you would be better off starting with a well-tested theme, something like:
https://github.com/theNewDynamic/gohugo-theme-ananke

Everything works! thank you so so much

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