Skip to content

Commit

Permalink
fix: hugo config module import (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-baiborodine committed Jun 17, 2024
1 parent 607abc5 commit acfa76d
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 44 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/update-demo-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,20 @@ jobs:
extended: true

- name: Create new demo site
run: hugo new site /tmp/demo-site

- name: Copy exampleSite content to new site
run: cp -r ./v4/exampleSite/* /tmp/demo-site
run: |
hugo new site /tmp/demo-site
rm /tmp/demo-site/archetypes/default.md
- name: Init Hugo module
working-directory: /tmp/demo-site
run: |
hugo mod init github.com/Lednerb/bilberry-hugo-theme/exampleSite
hugo mod get
hugo mod get -u
cat go.mod
- name: Copy exampleSite content to new site
run: cp -r ./v4/exampleSite/* /tmp/demo-site

- name: Adjust hugo.toml
working-directory: /tmp/demo-site
run: |
Expand Down
51 changes: 26 additions & 25 deletions v4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Please use the following guidelines if you want to start a discussion:

- **Hugo** (version >= 0.125.7 **extended**), see this [guide](https://gohugo.io/getting-started/installing/) on how to install Hugo.
- **Git**, see this [guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) on how to install Git.
- **Go** (version >= 1.19), optional, required only when the Bilberry theme is used as a Hugo module; see
- **Go** (version >= 1.21), optional, required only when the Bilberry theme is used as a Hugo module; see
this [guide](https://go.dev/doc/install) on how to install Go.

## Quick Start
Expand Down Expand Up @@ -145,18 +145,12 @@ hugo new site my-new-blog
rm my-new-blog/archetypes/default.md
```

- Copy the example site content, including the `hugo.toml` file:

```shell
cp -r bilberry-hugo-theme/v4/exampleSite/* my-new-blog
```

### Theme Installation Options

#### Option 1 (recommended): Adding the Theme as a Hugo Module

Use this option if you want to pull in the theme files as a Hugo module from the main Bilberry Hugo theme repository.
This option makes it easy to keep the theme up to date in your site.
Use this option if you want to pull in the theme files as a Hugo module from the main Bilberry Hugo
theme repository. This option makes it easy to keep the theme up to date in your site.

- Initialize your website as a Hugo module from the site's root:

Expand All @@ -165,13 +159,16 @@ cd my-new-blog
hugo mod init github.com/<your-user>/my-new-blog
```

Following the Hugo module initialization, you may have the following warning: module "
github.com/Lednerb/bilberry-hugo-theme/v4" not found, which should be ignored.
- Copy the example site content, including the `hugo.toml` file:

```shell
cp -r bilberry-hugo-theme/v4/exampleSite/* my-new-blog
```

- Pull theme files to add new content to your website:
- Pull theme files by updating theme's module:

```shell
hugo mod vendor
hugo mod get -u
```

If you need more details on how to use Hugo modules, please read
Expand All @@ -182,15 +179,17 @@ the [Hugo documentation](https://gohugo.io/hugo-modules/use-modules/).
Use this option if you want to pull in the theme files as a Git submodule from the main Bilberry Hugo theme repository.
This option also makes it easy to keep the theme up to date in your site.

- In the `my-new-blog/hugo.toml` file, uncomment the `theme` property for **Options 2 and 3**, and
comment out the `theme` property for **Option 1**:
- In the `my-new-blog/hugo.toml` file, uncomment the `path` property for **Options 2 and 3**, and
comment out the `path` property for **Option 1**:

```toml
# Option 1 (recommended): adding the theme as a hugo module
# theme = "github.com/Lednerb/bilberry-hugo-theme/v4"
[module]
[[module.imports]]
# Option 1 (recommended): adding the theme as a Hugo module
# path = "github.com/Lednerb/bilberry-hugo-theme/v4"

# Options 2 and 3: cloning/copying the theme files
theme = "bilberry-hugo-theme/v4"
# Options 2 and 3: cloning/copying the theme files
path = "bilberry-hugo-theme/v4"
```

- Add the Bilberry Hugo theme as a Git submodule from the site's root:
Expand All @@ -203,15 +202,17 @@ $ git submodule add https://github.com/Lednerb/bilberry-hugo-theme.git themes/bi

Use this option if you want to customize and maintain your own copy of the theme directly.

- In the `my-new-blog/hugo.toml` file, uncomment the `theme` property for **Options 2 and 3**, and
comment out the `theme` property for **Option 1**:
- In the `my-new-blog/hugo.toml` file, uncomment the `path` property for **Options 2 and 3**, and
comment out the `path` property for **Option 1**:

```toml
# Option 1 (recommended): adding the theme as a hugo module
# theme = "github.com/Lednerb/bilberry-hugo-theme/v4"
[module]
[[module.imports]]
# Option 1 (recommended): adding the theme as a Hugo module
# path = "github.com/Lednerb/bilberry-hugo-theme/v4"

# Options 2 and 3: cloning/copying the theme files
theme = "bilberry-hugo-theme/v4"
# Options 2 and 3: cloning/copying the theme files
path = "bilberry-hugo-theme/v4"
```

- Copy cloned (or unzipped) theme files in the previous step to the `my-new-blog/themes` directory:
Expand Down
12 changes: 7 additions & 5 deletions v4/exampleSite/hugo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
title = "My cool new Blog"
baseURL = "https://example.com/"

# Option 1 (recommended): adding the theme as a Hugo module
theme = "github.com/Lednerb/bilberry-hugo-theme/v4"
[module]
[[module.imports]]
# Option 1 (recommended): adding the theme as a Hugo module
path = "github.com/Lednerb/bilberry-hugo-theme/v4"

# Options 2 and 3: cloning/copying the theme files
# theme = "bilberry-hugo-theme/v4"
# Options 2 and 3: cloning/copying the theme files
# path = "bilberry-hugo-theme/v4"

# Generate the robots.txt file for SEO
enableRobotsTXT = true
Expand All @@ -27,7 +29,7 @@ disqusShortname = ""
css_modules = []
js_modules = []

# Description and meta data for the search engines
# Description and metadata for the search engines
author = "Lednerb"
description = "Bilberry Premium Theme for Hugo."
keywords = "blog,personal,responsive,search,font awesome,pages,posts,multilingual,syntax highlighting,premium,shortcuts"
Expand Down
2 changes: 1 addition & 1 deletion v4/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/Lednerb/bilberry-hugo-theme/v4

go 1.19
go 1.21
2 changes: 1 addition & 1 deletion v4/scripts/setup-example-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo ">>> Updating 'hugo.toml'..."

sed -i "s/title = .*$/title = \"Dev Bilberry Test\"/" exampleSite/hugo.toml
sed -i "s/subtitle = .*$/subtitle = \"Running locally!\"/" exampleSite/hugo.toml
sed -i "s/theme = .*$/theme = \"..\/..\/..\/..\/..\/v4\"/" exampleSite/hugo.toml
sed -i "s/path = .*$/path = \"..\/..\/..\/..\/..\/v4\"/" exampleSite/hugo.toml

echo ">>> ... completed."
exit 0
5 changes: 4 additions & 1 deletion v4/tests/exampleSite/hugo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
title = "My cool new Blog"
baseURL = "https://example.com/"
theme = "bilberry-hugo-theme/v4"

[module]
[[module.imports]]
path = "bilberry-hugo-theme/v4"

# Generate the robots.txt file for SEO
enableRobotsTXT = true
Expand Down
15 changes: 9 additions & 6 deletions v4/v4-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ Rename the site's configuration file from `config.toml` to `hugo.toml`.

### Theme Installation Options

Depending on your chosen theme installation option, update the theme property in the `hugo.toml` file as follows:
Depending on your chosen theme installation option, replace the `theme` property with
the `module.imports.path` property in the `hugo.toml` file as follows:

```toml
# Option 1 (recommended): adding the theme as a Hugo module
theme = "github.com/Lednerb/bilberry-hugo-theme/v4"
[module]
[[module.imports]]
# Option 1 (recommended): adding the theme as a Hugo module
path = "github.com/Lednerb/bilberry-hugo-theme/v4"

# Options 2 and 3: cloning/copying the theme files
theme = "bilberry-hugo-theme/v4"
# Options 2 and 3: cloning/copying the theme files
# path = "bilberry-hugo-theme/v4"
```

### Top Navigation Bar
Expand All @@ -38,7 +41,7 @@ In `v3`, color and font customizations were handled directly in the `assets/sass
the `_variables.scss` file no longer exists and such customization is done in the `config.toml` by defining
corresponding parameters from the `assets/sass/theme.scss` file, for example, `baseColor`, `headlineFont` etc.
Therefore, any changes you made in `_variables.scss` file should be ported to your site's configuration file `hugo.toml`. Read
the [Colors and Fonts](README.md#colors-and-fonts) section in the `v4` **README** guide for more details.
the [Layouts, Colors and Fonts](README.md#layout-colors-and-fonts) section in the `v4` **README** guide for more details.

### Image Modal Zoom

Expand Down

0 comments on commit acfa76d

Please sign in to comment.