Hugo Narrow support import local resources such as images with three methods:
- Page Bundles (markdown folder)
- Global Resources (assets folder)
- Static Resources (static folder)
Tip
Hugo Narrow follow the order to index the local resources:Page Bundles > Global Resources > Static Resources
Page Bundles
Page Bundles refer to resource files located in the same directory as the Markdown file. This is the most recommended method for managing image resources.
1content/
2└── posts/
3 ├── post-1.md
4 ├── post-1.zh-cn.md
5 └── post-2/
6 ├── index.md
7 ├── index.zh-cn.md
8 ├── featured.jpg
9 └── gallery/
10 ├── image-1.jpg
11 └── image-2.jpgUse in Markdown:
1
2
3Note
See Hugo documentation for more details.
Global Resources
Global resources are placed in the assets folder at the root directory of the site: ~/assets/. Resources placed in this folder will be processed by Hugo during the build.
1my-site/
2├── assets/
3│ └── images/
4│ └── hero.jpg
5├── content/
6└── themes/
7 └── hugo-narrow/Use in Markdown:
1Note
See Hugo documentation for more details.
Static Resources
Static resources are placed in the assets folder at the root directory of the site: ~/static/. Resources placed in this folder will NOT be processed by Hugo during the build.
1my-site/
2├── static/
3│ └── images/
4│ └── hero.jpg
5├── content/
6└── themes/
7 └── hugo-narrow/Use in Markdown:
1Note
See Hugo documentation for more details.
Different
| Location | Use | |
|---|---|---|
| Page Bundles | ~/content/posts/post-1/featured.jpg | featured.jpg |
| Global Resources | ~/assets/images/featured.jpg | images/featured.jpg |
| Static Resources | ~/static/images/featured.jpg | /images/featured.jpg |
Note
images is not necessary, you can change it.