hugo-scroll icon indicating copy to clipboard operation
hugo-scroll copied to clipboard

Hugo Module support?

Open spi43984 opened this issue 11 months ago • 4 comments

Hugo supports go modules which seam to offer easier updates (introduction to hugo modules) Is support for hugo modules planned for hugo-scroll?

Cheers, spi

spi43984 avatar May 20 '25 14:05 spi43984

Hi @spi43984 currently this is not planned, I am a quite busy elsewhere these days. I'll try to have a look at the feature and potentially plan for the future.

zjedi avatar Jun 04 '25 22:06 zjedi

thx - will do the same. As soon I find some time I'll dig into that as well...

spi43984 avatar Jun 05 '25 08:06 spi43984

hugo-scroll works just fine with Hugo modules for me. https://github.com/dholbach/scroll-multi is a small proof of concept that I put together to illustrate something a while ago.

Essentially following the Hugo modules how-to and running

hugo mod get github.com/zjedi/hugo-scroll

at the appropriate step will work out fine.

It could be nice if you mention here if you run into issues. And maybe we could just add a small section to the README.md with what worked out for you?

dholbach avatar Jul 15 '25 18:07 dholbach

Maybe the README should point out how to get the theme as a Hugo Module. Something alike:

Migrate from Git submodule to Hugo Module

hugo mod init github.com/me/my-existing-site # edit!
hugo mod get github.com/zjedi/hugo-scroll@latest

sed -i 's/^theme =.*/# Read [[module.imports]]/' hugo.toml
cat >> hugo.toml <<EOL

[module]
  proxy = "direct"
  [module.hugoVersion]
    extended = true
    min = "0.132.0"
  [[module.imports]]
    path = "github.com/zjedi/hugo-scroll"
    disable = false
EOL

# Remove the themes/hugo-scroll submodule from .gitmodules
git config --file .gitmodules --remove-section submodule.themes/hugo-scroll

# Remove the submodule directory from Git's index (if it still exists)
git rm --cached themes/hugo-scroll 2>/dev/null || true

# Remove any leftover configuration
git config --remove-section submodule.themes/hugo-scroll 2>/dev/null || true

# Remove the module directory
rm -rf .git/modules/themes/hugo-scroll 2>/dev/null || true

# Commit the changes
git add .gitmodules
git commit -m "Remove themes/hugo-scroll submodule (migrated to Hugo Modules)"

# Verify .gitmodules now only contains your data submodules
cat .gitmodules

hugo mod vendor # optional

hugo server

I tried to explain previous code in this unit of my post. TLDR: customize the steps of the Docsy theme documentation Migrate to Hugo Modules for Hugo Scroll.

Create the Hugo Scroll demo from scratch

hugo new site quickstart
cd quickstart

hugo mod init github.com/me/my-existing-site # edit!
hugo mod get github.com/zjedi/hugo-scroll@latest # ⏳ wait few seconds

cd .. # out of quickstart
git clone https://github.com/zjedi/hugo-scroll.git
cd hugo-scroll
my_repo="../quickstart"
cp -rv exampleSite/content/* "$my_repo"/content/
cp -rv exampleSite/assets/* "$my_repo"/assets/
cp -v exampleSite/hugo.toml "$my_repo"/
rm -v "$my_repo"/archetypes/* # to use the hugo-scroll ones

cd "$my_repo"
sed -i 's/^theme =.*/# Read [[module.imports]]/' hugo.toml
cat >> hugo.toml <<EOL

[module]
  proxy = "direct"
  [module.hugoVersion]
    extended = true
    min = "0.132.0"
  [[module.imports]]
    path = "github.com/zjedi/hugo-scroll"
    disable = false
EOL

hugo mod vendor # optional

hugo server

Code explained in this other unit of my post.

All reviews are welcome!

juanMarinero avatar Sep 07 '25 20:09 juanMarinero