Image path wrong when using different url:

Hi,
I’m creating a new category “bookshop” on my site.
The folders are organised like so.

.
└── categories/
    └── bookshop/
        ├── images
        ├── _index.en.md
        ├── book1/
        │   ├── index.en.md
        │   └── images/
        └── book2/
            ├── index.en.md
            └── images/

However,the images in my markdown file _index.en.md don’t show in the output (src=""is empty). I noticed that they copy in /categories/bookshop/images/ in the output folder. However my config for category slug is like so in config.toml

[permalinks]
	posts = '/:year/:month/:slugorfilename/'
  categories = '/:slug/'

So they should get processed and copied in /bookshop/images/

If I manually set the url to url: /categories/bookshop in the front matter, then the images display since they are next to the rendered file.

How can I make sure the images end up in the right location?

Goal:

.
└── public/
    └── bookshop/
        ├── images/
        └── index.html
      

Current output (wrong)

.
└── public/
    ├── bookshop/
    │   └── index.html
    └── categories/
        └── bookshop/
            └── images/

“categories” is one of the default taxonomies. Are you using it as a taxonomy, or have you disabled its use as a taxonomy? I ask because the directory structure and permalink kind depend on the answer.

1 Like

I am using it as a category.
in config.toml

[taxonomies]
  author = "authors"
  tag = "tags"
  category = "categories"
  translator = "translators"
  lang = "languages"

Then your directory structure doesn’t make any sense. You should have a top level directory for the taxonomy, and a subdirectory for each term.

content/
└── categories/
    ├── category-1/
    │   └── _index.md
    ├── category-2/
    │   └── _index.md
    └── _index.md


This is already what I have.
I simply want it to output as

.
└── public/
    └── bookshop/
        ├── images/
        └── index.html

Not according to your initial post.

This works fine.

git clone --single-branch -b hugo-forum-topic-53205 https://github.com/jmooring/hugo-testing hugo-forum-topic-53205
cd hugo-forum-topic-53205
rm -rf public && hugo && tree public