dirkolbrich / hugo-tailwindcss-starter-theme

Starter files for a Hugo theme with Tailwindcss
MIT License
398 stars 55 forks source link

hugo server home page not found #52

Closed Juniors017 closed 8 months ago

Juniors017 commented 8 months ago

Hi thank you very munch for your work

I installed your theme, followed all the instructions, but when I copy the example site into my project to have a sample, and I run hugo server, the site generation is successful but the homepage shows "page not found." I have an _index.md in the content directory; should I have a page displayed? Also, I see the following error message:

WARN  found no layout file for "html" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
dirkolbrich commented 8 months ago

Mmmhh, hard to say without knowing your projects folder structure. From the error message it seems that Hugo does not find the layouts/ folder of the (or any other) theme and thus the template files. Maybe check if your file paths are set up correctly. If you need more assistance, do you mind sharing:

edit: You maybe need to modify the config.toml of the copied example site as well to point the line theme = "new-theme-name" to the correct theme folder within your project.

Juniors017 commented 8 months ago

hi @dirkolbrich

i restart all for test but it's same. my repo : https://github.com/Juniors017/diyhugo.git my config.toml :

`theme = "diyhugo"
languageCode = "en-us"
baseurl = "http://example.com/"
title = "Hugo Tailwindcss Starter"

author = "Dirk Olbrich"
copyright = "Copyright © 2019-2024, Dirk Olbrich, all rights reserved."

[params]
    name = "Hugo Tailwindcss Starter"
    description = "A simple bootstraped theme for Hugo, build with Tailwindcss."

    github_user = "dirkolbrich"
    github_repo = "https://github.com/dirkolbrich/hugo-tailwindcss-starter-theme"
    github_banner = true

    favicon = "favicon.ico"

# syntax highlight settings
[markup]
  [markup.highlight]
    style = "dracula"`

My commande for start hugo :


Watching for changes in C:\Users\******\*****\****ite\site *****\diyhugo\{archetypes,assets,content,data,i18n,layouts,static}
Watching for config changes in C:\Users\****\*****\**\si****\diyhugo\hugo.toml
Start building sites …
hugo v0.121.0-e321c3502aa8e80a7a7c951359339a985f082757+extended windows/amd64 BuildDate=2023-12-05T15:22:31Z VendorInfo=gohugoio

WARN  found no layout file for "html" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.      
WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.     

                   | EN
-------------------+-----
  Pages            |  4  
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  0
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  1
  Cleaned          |  0

Built in 44 ms
Environment: "development"
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop```

i don't have problem with other start theme :s 
dirkolbrich commented 8 months ago

I found the error: You have 2 conflicting .toml configuration files in your projects root folder. A config.toml file from the hugo-tailwindcss-starter-theme/exampleSite folder you copied over and a hugo.toml configuration file from the default Hugo hugo new site initialization.

With gohugo v0.109 the naming of the configuration file changed from config.toml to hugo.toml -> see https://gohugo.io/getting-started/configuration/. The exampleSite folder in my repo did not catch up with this change yet. I might have to do that now, to prevent further misunderstandings.

Delete the hugo.toml file in your project (it just holds the default configuration) and rename the copied over config.toml to hugo.toml (Or don't. It doesn't really matter as gohugo recognizes both file names. Just not 2 at the same time). Then you should be able to to run the site with hugo server --disableFastRender.

Juniors017 commented 8 months ago

hi i 'm testing but i have this second error :

''' hugo v0.121.0-e321c3502aa8e80a7a7c951359339a985f082757+extended windows/amd64 BuildDate=2023-12-05T15:22:31Z VendorInfo=gohugoio

Built in 114 ms Error: error building site: POSTCSS: failed to transform "css/styles.css" (text/css): 'C:\Program' n'est pas reconnu en tant que commande interne ou externe, un programme ex�cutable ou un fichier de commandes. PS C:\Users**\Docu*********\site ***\diyhugo>

''' i was run your process line per line

dirkolbrich commented 8 months ago

Looks like the NPM packages are not installed. You first have to run nom install within thee themes/diyhugo folder.

dirkolbrich commented 8 months ago

Here are the steps I used to make your repo work:

// clone the repo
$ git clone https://github.com/Juniors017/diyhugo.git
$ cd diyhugo

// delete the default config file
$ rm hugo.toml

// change into the themes folder and install Npm packages
$ cd themes/diyhugo
$ npm install

// change back into the project root and start the server
$ cd ../..
$ hugo server --disableFastRender
Juniors017 commented 8 months ago

hi "I thank you for your help and sincerely apologize for bothering you so much. I have never had so many issues with Hugo. Here is what I have following the steps." after git clone:

Receiving objects: 100% (58/58), 30.17 KiB | 1.44 MiB/s, done. PS C:\Users****\diyhugo\diyhugo> rm hugo.toml PS C:\Users****\diyhugo\diyhugo> cd themes/diyhugo PS C:\Users****\diyhugo\diyhugo\themes\diyhugo> npm install

added 132 packages, and audited 133 packages in 8s

30 packages are looking for funding run npm fund for details found 0 vulnerabilities PS C:\Users****\diyhugo\themes\diyhugo> cd ../.. PS PS C:\Users****\diyhugo> hugo server --disableFastRender Watching for changes in PS C:\Users****\diyhugo{archetypes,content,layouts,themes} Watching for config changes in PS C:\Users****\diyhugo\config.toml hugo v0.121.0-e321c3502aa8e80a7a7c951359339a985f082757+extended windows/amd64 BuildDate=2023-12-05T15:22:31Z VendorInfo=gohugoio

Built in 171 ms Error: error building site: POSTCSS: failed to transform "css/styles.css" (text/css): 'C:\Program' n'est pas reconnu en tant que commande interne

dirkolbrich commented 8 months ago

Please read the installation instructions carefully!

Make sure to install postcss-cli and autoprefixer globally in your environment, as Hugo Pipe’s PostCSS requires it. This is mentioned in the Hugo Docs.

npm install -g postcss-cli
npm install -g autoprefixer
Juniors017 commented 8 months ago

"I have followed everything to the letter; your documentation is very clear." but ...

dirkolbrich commented 8 months ago

Well, then I'm out of luck as you are on a Windows system and I don't know how to handle the command line and paths there. Your error message (in french) read translated 'C:\Program' is not recognized as an internal command which seems to indicate that somewhere a wrong path is given or your system does not recognise the internal paths. I don't know.

Juniors017 commented 8 months ago

Okay, I have a other system under Linux; I will test it on there and provide feedback. I will keep you updated. Thank you for your assistance and prompt response.

dirkolbrich commented 8 months ago

I think the error might come from how Windows expands relative paths. I guess the error might occur in this line https://github.com/Juniors017/diyhugo/blob/d3b73b32dceeabef2c9c6ef33c74bc12490e708f/themes/diyhugo/layouts/partials/css.html#L1:

{{- $styles := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/postcss.config.js") -}}

where the given relative path to posts.config.js is somehow not correctly expanded.

Can you please start the server with the verbose option, this might give more hints:

hugo server --disableFastRender --verbose
Juniors017 commented 8 months ago

Hi ji ust tested it on my Zorin Linux environment, and I had no issues. The installation was quick and easy, as usual with Hugo.

I will try again on my Windows 10 environment following the advice you mentioned earlier, and I'll provide a quick update here.

Juniors017 commented 8 months ago

hi

this results with --verbose option :


PS C:\Users\valen\Documents\Dev_site\site valentin\diyhugo> hugo server --disableFastRender --verbose
WARN  deprecated: --verbose was deprecated in Hugo v0.114.0 and will be removed in a future release. use --logLevel info
Watching for changes in C:\Users\valen\Documents\Dev_site\site valentin\diyhugo\{archetypes,content,layouts,package.json,themes}
Watching for config changes in C:\Users\valen\Documents\Dev_site\site valentin\diyhugo\hugo.toml
Start building sites …
hugo v0.121.0-e321c3502aa8e80a7a7c951359339a985f082757+extended windows/amd64 BuildDate=2023-12-05T15:22:31Z VendorInfo=gohugoio

INFO  copy static: syncing static files to \
INFO  build: running step "process" duration "4.0068ms"
INFO  build: running step "assemble" duration "3.541ms"
INFO  deprecated: .Site.IsServer was deprecated in Hugo v0.120.0 and will be removed in a future release. Use hugo.IsServer instead.
INFO  postcss: use config file "C:\\Users\\valen\\Documents\\Dev_site\\site valentin\\diyhugo\\themes\\diyhugo\\assets\\css\\postcss.config.js" 
INFO  postcss: 'C:\Program' n'est pas reconnu en tant que commande interne
ou externe, un programme ex�cutable ou un fichier de commandes.
INFO  build: running step "render" duration "302.6358ms"
INFO  build: running step "postProcess" duration "0s"
Built in 357 ms
Error: error building site: POSTCSS: failed to transform "css/styles.css" (text/css): 'C:\Program' n'est pas reconnu en tant que commande interne
ou externe, un programme ex�cutable ou un fichier de commandes.
PS C:\Users\valen\Documents\Dev_site\site valentin\diyhugo> 
dirkolbrich commented 8 months ago

Ok, so it's definitely a Windows path issue. The weird thing is, which I have never seen before, that the complete log is in English while the error message suddenly is in French locale language. Sorry I'm out off ideas here and can't offer any further help. I duckduckgoed the error message and found a stackOverflow thread, maybe you try this.

dirkolbrich commented 8 months ago

I see you opened a thread on the gohugo forums. The first response pointed to issue #7333 which indicates this is a known Hugo internal bug with paths on Windows, where a folder within this path contains a space. A quick fix for your use case would be to replaces the space in folder site valentin in your path with e.g. an underscore to site_valentin. Anyways, there is not much I can do as this is an upstream bug, so I will close this issue.

Juniors017 commented 8 months ago

Hi Dirk,

the solution : https://discourse.gohugo.io/t/tailwind-postcss-work-with-linux-but-dont-work-with-windows/47899

Apologies sincerely for that