Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issue with hugo module installation that appeared within the past few days #593

Closed
TikkunCreation opened this issue Jun 28, 2023 · 11 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@TikkunCreation
Copy link

TikkunCreation commented Jun 28, 2023

Issue description

I think a downstream package might've introduced some kind of issue in the past few days.

This set of commands worked fine for me on Sunday 25th June, but not today Wed 28th June.

To reproduce the issue:

# Create a new Hugo site
hugo new site retesthugomod
cd retesthugomod

# Initialize Hugo module
hugo mod init retesthugomod

# Tidy up dependencies
go mod tidy

# Create configuration directories
mkdir -p config/_default

# Add submodule path to module.toml
echo "[[imports]]\npath = \"github.com/jpanther/congo/v2\"" > config/_default/module.toml

# Download additional configuration files
curl -L --output config/_default/config.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/config.toml
curl -L --output config/_default/languages.en.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/languages.en.toml
curl -L --output config/_default/markup.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/markup.toml
curl -L --output config/_default/menus.en.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/menus.en.toml
curl -L --output config/_default/params.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/params.toml

# Remove unneeded configuration file
rm hugo.toml

# Create a new post
hugo new posts/_index.md

# Update the draft status and add content to the post
sed -i '' 's/draft: true/draft: false/g' content/posts/_index.md && echo -e "\n\n# Home" >> content/posts/_index.md

# Start Hugo server
hugo server

And here is the corresponding Zsh one-liner:

hugo new site retesthugomod && cd retesthugomod && hugo mod init retesthugomod && go mod tidy && mkdir -p config/_default && echo "[[imports]]\npath = \"github.com/jpanther/congo/v2\"" > config/_default/module.toml && curl -L --output config/_default/config.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/config.toml && curl -L --output config/_default/languages.en.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/languages.en.toml && curl -L --output config/_default/markup.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/markup.toml && curl -L --output config/_default/menus.en.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/menus.en.toml && curl -L --output config/_default/params.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/params.toml && rm hugo.toml && hugo new posts/_index.md && sed -i '' 's/draft: true/draft: false/g' content/posts/_index.md && echo -e "\n\n# Home" >> content/posts/_index.md && hugo server

Note that using git submodules still works fine.

Can someone who is reading this please follow my steps and comment whether you run into the same issue? (Congo theme isn't downloaded/loaded)

Theme version

v2.6.1

Hugo version

hugo v0.114.1+extended darwin/arm64

Which browser rendering engines are you seeing the problem on?

  • Chromium (Google Chrome, Microsoft Edge, Brave, Vivaldi, etc.)
  • Firefox (Mozilla Firefox)
  • WebKit (Safari)
  • Other

URL to sample repository or website

No response

Hugo output or build error messages

Start building sites …
hugo v0.114.1+extended darwin/arm64 BuildDate=unknown

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.
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 "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "json" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

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

Built in 28 ms
Watching for changes in /Users/user/Downloads/testing-again/retesthugomod/{archetypes,assets,content,data,layouts,static}
Watching for config changes in /Users/user/Downloads/testing-again/retesthugomod/config/_default
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
@TikkunCreation TikkunCreation added the bug Something isn't working label Jun 28, 2023
@TikkunCreation
Copy link
Author

TikkunCreation commented Jun 28, 2023

Here's the successfully working version using git submodules, rather than hugo submodules.

# Create a new Hugo site
hugo new site gitsubmodule3

# Navigate to the newly created site's directory
cd gitsubmodule3

# Initialize git in the directory
git init

# Add the git submodule for the theme
git submodule add -b stable https://github.com/jpanther/congo.git themes/congo

# Remove the hugo.toml file
rm hugo.toml

# Copy the theme's config files to the site's config directory
mkdir -p config/_default
cp themes/congo/config/_default/*.toml config/_default

# Add the theme name to the config file
echo 'theme = "congo"' > temp
cat config/_default/config.toml >> temp
mv temp config/_default/config.toml

# Create a new post
hugo new posts/_index.md

# Set the post to not be a draft and add a title
sed -i '' 's/draft: true/draft: false/g' content/posts/_index.md
echo -e "\n\n# Home" >> content/posts/_index.md

# Start the Hugo server
hugo server

And the corresponding zsh one liner

hugo new site gitsubmodule5 && cd gitsubmodule5 && git init && git submodule add -b stable https://github.com/jpanther/congo.git themes/congo && rm hugo.toml && mkdir -p config/_default && cp themes/congo/config/_default/*.toml config/_default && echo 'theme = "congo"' > temp && cat config/_default/config.toml >> temp && mv temp config/_default/config.toml && hugo new posts/_index.md && sed -i '' 's/draft: true/draft: false/g' content/posts/_index.md && echo -e "\n\n# Home" >> content/posts/_index.md && hugo server

@TikkunCreation
Copy link
Author

TikkunCreation commented Jun 28, 2023

Hm. As an update, I tried this on my other machine and was unable to replicate the issue.

I used this command on my other machine:

arch -arm64 hugo new site retesthugomod && cd retesthugomod && arch -arm64 hugo mod init retesthugomod && arch -arm64 go mod tidy && mkdir -p config/_default && echo "[[imports]]\npath = \"github.com/jpanther/congo/v2\"" > config/_default/module.toml && curl -L --output config/_default/config.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/config.toml && curl -L --output config/_default/languages.en.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/languages.en.toml && curl -L --output config/_default/markup.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/markup.toml && curl -L --output config/_default/menus.en.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/menus.en.toml && curl -L --output config/_default/params.toml https://raw.githubusercontent.com/jpanther/congo/stable/config/_default/params.toml && rm hugo.toml && arch -arm64 hugo new posts/_index.md && sed -i '' 's/draft: true/draft: false/g' content/posts/_index.md && echo -e "\n\n# Home" >> content/posts/_index.md && arch -arm64 hugo server

Any suggestions as to how to debug the issue?

@jpanther
Copy link
Owner

Thanks for the issue report, @TikkunCreation. I wonder if this is because Hugo is caching the module and so it's not updating it correctly when you re-run your script. Have you tried using the command hugo mod clean instead of tidy to see if this helps?

@TikkunCreation
Copy link
Author

Thanks for the issue report, @TikkunCreation. I wonder if this is because Hugo is caching the module and so it's not updating it correctly when you re-run your script. Have you tried using the command hugo mod clean instead of tidy to see if this helps?

You are 100% correct. Doing the following fixed the issue (and as expected it fixed it across all my congo sites, not just the one in the current directory):

hugo mod clean
hugo serve

I'm going to leave this issue open in case you want to add anything to the docs, or any kind of fix to detect when this is happening. Feel free to close it at your preference.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any recent activity.
If you are still experiencing this issue, please review the issue history and add a reply with any requested and/or additional information in order to keep the issue open.
This issue will automactically close in 14 days if no further activity occurs.

@github-actions github-actions bot added the stale This issue or pull request has not had any recent activity label Jul 30, 2023
@TikkunCreation
Copy link
Author

This issue recurs frequently. It is always solvable with hugo mod clean

It may be good to add that to the docs somewhere.

@github-actions github-actions bot removed the stale This issue or pull request has not had any recent activity label Jul 31, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any recent activity.
If you are still experiencing this issue, please review the issue history and add a reply with any requested and/or additional information in order to keep the issue open.
This issue will automatically close in 14 days if no further activity occurs.

@github-actions github-actions bot added the stale This issue or pull request has not had any recent activity label Aug 31, 2023
@jpanther jpanther removed the stale This issue or pull request has not had any recent activity label Sep 9, 2023
@jpanther
Copy link
Owner

Where would you look for this information in the docs if you had this issue? Would it make sense to add a comment in the installation section? Or does it make more sense in deployment? It is briefly referenced in the upgrade guide but it's not the most obvious place to find it if you're coming to Congo as a new user.

@TikkunCreation
Copy link
Author

I'm not sure, I'd likely:

google 'hugo 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.'

google 'hugo congo 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.'

(without quotes)

And hope that it comes up from that. With issues I generally don't browse in the docs, I'll trust that a keyword search will surface it

@jpanther
Copy link
Owner

That's what I would do too. I think the issue here is largely to do with how the hugo mod command works as really it should be cleaning up as it goes if it ends up causing issues like this.

@jpanther
Copy link
Owner

I've now made an update to the docs to reference the hugo mod clean command (29f7bb8) so I'm going to close off this issue.

@jpanther jpanther added the documentation Improvements or additions to documentation label Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants