Skip to content

Commit

Permalink
Cleanup hugo.config
Browse files Browse the repository at this point in the history
  • Loading branch information
schnerring committed Aug 30, 2024
1 parent 327bb37 commit dcb9911
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 26 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Initialize the site as Hugo module
hugo mod init example.com
```

Add the following to the `config.toml` file:
Add the following to the `hugo.toml` file:

```toml
[markup]
Expand Down Expand Up @@ -171,8 +171,8 @@ Two options are available to configure the theme colors:

## Prism

The theme allows customization of [Prism](https://prismjs.com/) via
`config.toml` parameters:
The theme allows customization of [Prism](https://prismjs.com/) via `hugo.toml`
parameters:

```toml
[params]
Expand Down Expand Up @@ -242,7 +242,7 @@ Additionally, all images are lazily loaded to save the bandwidth of your users.

The default quality is 75%. See the
[official Image Processing Config Hugo docs](https://gohugo.io/content-management/image-processing/#image-processing-config).
Change it by adding the following to the `config.toml` file:
Change it by adding the following to the `hugo.toml` file:

```toml
[imaging]
Expand Down Expand Up @@ -509,7 +509,7 @@ I'm a .NET developer by trade, so let's say hello in C#!

The theme comes with a tag cloud partial. It is included in the sidebar, but it
is disabled by default. If you wish to configure it, add the following to the
`[params]` section in the `config.toml` file:
`[params]` section in the `hugo.toml` file:

```toml
[params.tagCloud]
Expand Down
26 changes: 17 additions & 9 deletions content/blog/image-optimization/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ socialShare: true
toc: true
cover:
src: ./alexandre-van-thuan-mr9FouttLGY-unsplash.jpg
alt: The interior of Stadsbiblioteket in Stockholm - Gunnar Asplunds library from 1928. The architecture is a transition between neoclassicism and functionalism.
alt:
The interior of Stadsbiblioteket in Stockholm - Gunnar Asplunds library from
1928. The architecture is a transition between neoclassicism and
functionalism.
caption: By [Alexandre Van Thuan](https://unsplash.com/photos/mr9FouttLGY)
---

The theme optimizes images by default with a custom [Hugo's markdown render hook](https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks):
The theme optimizes images by default with a custom
[Hugo's markdown render hook](https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks):

- The theme creates resized versions for each image, ranging from 100 to 700
pixels wide.
Expand All @@ -31,7 +35,10 @@ your posts to add cover images:
---
cover:
src: alexandre-van-thuan-mr9FouttLGY-unsplash.jpg
alt: The interior of Stadsbiblioteket in Stockholm - Gunnar Asplunds library from 1928. The architecture is a transition between neoclassicism and functionalism.
alt:
The interior of Stadsbiblioteket in Stockholm - Gunnar Asplunds library from
1928. The architecture is a transition between neoclassicism and
functionalism.
caption: By [Alexandre Van Thuan](https://unsplash.com/photos/mr9FouttLGY)
---
```
Expand All @@ -52,8 +59,9 @@ Add captions to your inline images like this:

## JPEG and WebP Quality

The default quality is 75%. See the [official Image Processing Config Hugo docs](https://gohugo.io/content-management/image-processing/#image-processing-config).
Change it by adding the following to the `config.toml` file:
The default quality is 75%. See the
[official Image Processing Config Hugo docs](https://gohugo.io/content-management/image-processing/#image-processing-config).
Change it by adding the following to the `hugo.toml` file:

```toml
[imaging]
Expand All @@ -63,8 +71,8 @@ Change it by adding the following to the `config.toml` file:
## Resizing

By default, the theme creates resized versions of images ranging from 300 to 700
pixels wide in increments of 100 pixels. Override the resize behavior by
adding the following to the `config.toml` file:
pixels wide in increments of 100 pixels. Override the resize behavior by adding
the following to the `hugo.toml` file:

```toml
[params]
Expand All @@ -76,7 +84,7 @@ adding the following to the `config.toml` file:

## Lazy Loading

Images are lazily loaded by default using the `loading="lazy"` attribute on
HTML `img` tags.
Images are lazily loaded by default using the `loading="lazy"` attribute on HTML
`img` tags.

{{< video src="lazy-loading" autoplay="true" controls="false" loop="true" >}}
24 changes: 13 additions & 11 deletions content/blog/prism-code-highlighting-showcase.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ themes usually include a pre-configured version of Prism, which complicates
updates and clutters the source code base with third-party JavaScript.

Only the Prism features you select in the Hugo site configuration are bundled by
the build process. This way, Prism can be easily updated with `npm` and the
size of the JavaScript and CSS bundles are minimized by only including what you
need.
the build process. This way, Prism can be easily updated with `npm` and the size
of the JavaScript and CSS bundles are minimized by only including what you need.

<!--more-->

Here is a an example configuration demonstrating how to configure `languages`
and `plugins` in the `config.toml` file of your Hugo site:
and `plugins` in the `hugo.toml` file of your Hugo site:

```toml
[params]
Expand Down Expand Up @@ -51,12 +50,15 @@ The following languages are available:
## Plugins

Before using a plugin in production, read its documentation and test it
thoroughly. E.g., the [`remove-initial-line-feed` plugin](https://prismjs.com/plugins/remove-initial-line-feed/)
is still available despite being deprecated in favor of [`normalize-whitespace`](https://prismjs.com/plugins/normalize-whitespace/).
thoroughly. E.g., the
[`remove-initial-line-feed` plugin](https://prismjs.com/plugins/remove-initial-line-feed/)
is still available despite being deprecated in favor of
[`normalize-whitespace`](https://prismjs.com/plugins/normalize-whitespace/).

Many Prism plugins require using `<pre>` tags with custom attributes. Hugo uses
Goldmark as Markdown handler, which by default doesn't render raw inline HTML,
so make sure to enable [`unsafe`](https://gohugo.io/getting-started/configuration-markup#goldmark)
so make sure to enable
[`unsafe`](https://gohugo.io/getting-started/configuration-markup#goldmark)
rendering if required:

```toml
Expand All @@ -77,7 +79,7 @@ The following plugins are available:
#### Copy to Clipboard

`copy-to-clipboard` requires the `toolbar` plugin, so make sure to add it
**after** adding `toolbar` in the `config.toml` file:
**after** adding `toolbar` in the `hugo.toml` file:

Config:

Expand Down Expand Up @@ -234,9 +236,9 @@ Output:
<pre class="language-diff-javascript diff-highlight">
<code>
@@ -4,6 +4,5 @@
- let foo = bar.baz([1, 2, 3]);
- foo = foo + 1;
+ const foo = bar.baz([1, 2, 3]) + 1;
- let foo = bar.baz([1, 2, 3]);
- foo = foo + 1;
+ const foo = bar.baz([1, 2, 3]) + 1;
console.log(`foo: ${foo}`);
</code>
</pre>
Expand Down
Empty file added i18n/.gitkeep
Empty file.
1 change: 0 additions & 1 deletion theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ tags = [
"responsive"
]
features = ["dark mode"]
min_version = "0.41.0"

[author]
name = "Michael Schnerring"
Expand Down

0 comments on commit dcb9911

Please sign in to comment.