Sean Dittmar
Sean Dittmar

Reputation: 51

Hugo blog + netlify deployment + custom domain = page not found..frustrating stuff

I keep getting a page not found error, no matter what I do. Both urls, my custom domain (https://dittmaraz.life) and netlify's subdomain (https://compassionate-lumiere-512b58.netlify.com) both give me 'page not found'. This is a error page that says:

Page Not Found Looks like you've followed a broken link or entered a URL that doesn't exist on this site.

Here's the github repo.

No build errors. There's one blog post and its draft property is set to false. netlify's build settings are set to the initial settings. Also, config.toml's baseURL is set to 'https://dittmaraz.life/'.

Any suggestions?

Upvotes: 2

Views: 755

Answers (2)

Bit33
Bit33

Reputation: 358

I see two issues:

Wrong publishDir:

As Talves already points out, the content is generated into /docs instead of the default /public directory. Easy fix, remove the publishDir from config.toml by commenting it out:

#publishDir = "docs"

Generated content in Git repository:

Netlify will generate your site, it should not be in the Git repository.

  1. remove both directories /public and /docs
  2. commit to Git
  3. add .gitignore with this content:

    /public/ /resources/

Upvotes: 1

talves
talves

Reputation: 14353

You are using the default deploy folder public, but your config.toml for the site is deploying to docs

baseURL = "https://dittmaraz.life/"
languageCode = "en-us"
title = "dittmaraz"
theme = "mediumish-gohugo-theme"
summaryLength = 25
copyright = "2019 dittmaraz.life"
enableEmoji = true
publishDir = "docs"

You can change this in the app.netlify.com admin console for the site or create a netlify.toml at the root of your repository

netlify.toml

[build]
  command = "hugo"
  publish = "docs"

Alternatively, you can just deploy it to public by changing the value from docs to public

Upvotes: 3

Related Questions