# Multilingual site and relative content image links

**URL:** <https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056>\
**Category:** support\
**Created:** [January 17, 2018, 4:17pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056 "2018-01-17T16:17:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![kizu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kizu/32/4982_2.png) [@kizu](https://discourse.gohugo.io/u/kizu)\
**Post date:** [January 17, 2018, 4:17pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/1 "2018-01-17T16:17:27Z")

</div>

Hi, everyone!

I’m thinking of moving my site from custom gulp-based solution to Hugo, and have one problem: my posts have this structure:

```
some-post
├── index.en.md
├── index.ru.md
└── illustration.png

```

Then, I have one default language: `ru`, and one extra — `en`.

In both my `.md` files I call my image as usual: `![…](illustration.png)`

The problem: this image generated from markdown has `src="illustration.png"`, so it works for the unprefixed default language, but not for the one that has a language prefix.

In my custom solution, I handled this in a most straightforward way: just by copying the image for every language generated. Is there a way to do the same in Hugo?

Another solution could be to replace the links at the template level, maybe there is something like that as well? Is it possible to get the behaviour I’m expecting?

The important part is that in the source `.md` files I totally want to have just a source-relative link, as this way it would be shown by any other markdown viewer/editor (like github).

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 17, 2018, 4:22pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/2 "2018-01-17T16:22:12Z")

</div>

While I can imagine situations not covered, yours is not one of them.

Have you tested this with the latest Hugo?

---

<div class="post-metadata">

**Author:** ![kizu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kizu/32/4982_2.png) [@kizu](https://discourse.gohugo.io/u/kizu)\
**Post date:** [January 17, 2018, 4:34pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/3 "2018-01-17T16:34:56Z")

</div>

Hmm, yep, I think I could have an older version of Hugo (from September?), I’ll update it and would reply if that would help, thanks!

---

<div class="post-metadata">

**Author:** ![kizu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kizu/32/4982_2.png) [@kizu](https://discourse.gohugo.io/u/kizu)\
**Post date:** [January 17, 2018, 4:37pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/4 "2018-01-17T16:37:44Z")

</div>

Yep, works, and by copying the illustration to both paths, that is awesome!

(sorry, not used to binary tools that you need to update manually, used to having always latest stuff from npm for the new projects)

So far I’m amazed at how Hugo does all the stuff in ways I’m already used to: especially this naming convention for multilang sites, really nice work there!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 17, 2018, 4:41pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/5 "2018-01-17T16:41:23Z")

</div>

> [@kizu](#):
>
> Yep, works, and by copying the illustration to both paths, that is awesome!

You should also have a look at the image processing feature in Hugo 0.32 – which is going to be improved in Hugo 0.33 with front matter meta data:

[http://hugotest.bep.is/section3/2017/11/my-cool-article-1b/](http://hugotest.bep.is/section3/2017/11/my-cool-article-1b/)

And this is Hugo next:

[http://hugotest.bep.is/resourcemeta/bundle-with-resource-meta-yaml/](http://hugotest.bep.is/resourcemeta/bundle-with-resource-meta-yaml/)

This also works seamlessly in multilingual mode.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 17, 2018, 4:44pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/6 "2018-01-17T16:44:12Z")

</div>

Also a tip: The language naming convention also extends to other resources, images etc.

---

<div class="post-metadata">

**Author:** ![kizu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kizu/32/4982_2.png) [@kizu](https://discourse.gohugo.io/u/kizu)\
**Post date:** [January 17, 2018, 8:59pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/7 "2018-01-17T20:59:06Z")

</div>

Hmm, interesting!

Although, I have a question re: how I do my structure with the index files: if I have something like that:

```
2018-01-04-counters-and-stones
└── index.en.md

```

Then inside `.md` I have metadata with `slug` equal to `counters-and-stones`.

I have two questions/problems:

1. The url generated for this article is not that I expect: `en/posts/2018-01-04-counters-and-stones/counters-and-stones/`, I don’t want to have the initial part with the date and want to have only the slug I have given in metadata. Is there a way to override this?
2. I have another default language, and there is no translation for it at this directory. But I still get generated `posts/2018-01-04-counters-and-stones/counters-and-stones/` url for this article (while articles that are present only for default language are not copied for non-default without translations). While I find it to be a feature rather than a bug, I would probably want to control it: is it an intended behaviour and if yes, then if there is a way to control it using some config or metadata options?

---

<div class="post-metadata">

**Author:** ![kizu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kizu/32/4982_2.png) [@kizu](https://discourse.gohugo.io/u/kizu)\
**Post date:** [January 17, 2018, 9:13pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/8 "2018-01-17T21:13:18Z")

</div>

Aha, for the first question I found my own answer: `[permalinks]` with `posts = "/:section/:slug/"` seems to do what I want!

---

<div class="post-metadata">

**Author:** ![kizu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kizu/32/4982_2.png) [@kizu](https://discourse.gohugo.io/u/kizu)\
**Post date:** [January 17, 2018, 9:39pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/9 "2018-01-17T21:39:51Z")

</div>

Oh! But I’ve noticed another thing that is connected to the second point: while a page is created for my default language, the image is not copied to it, so it is only available for the original version under the `en/`

---

<div class="post-metadata">

**Author:** ![kizu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kizu/32/4982_2.png) [@kizu](https://discourse.gohugo.io/u/kizu)\
**Post date:** [January 17, 2018, 10:23pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/10 "2018-01-17T22:23:03Z")

</div>

And another thing: when I use this method with mmark, the include don’t seem to work: `{{lol.html}}` when it is placed in the same folder as `index.en.md` would give an error:

```
mmark: failed: `lol.html': open lol.html: no such file or directory

```

From the mmark’s docs:

```
the filename is taken relative to working directory of the Mmark process

```

It seems that the working directory for mmark is **not** the one each document has, but the root of the whole project. I wonder: if there a way to make the working directory to be the source folder of each document in that case?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 17, 2018, 10:41pm UTC](https://discourse.gohugo.io/t/multilingual-site-and-relative-content-image-links/10056/11 "2018-01-17T22:41:08Z")

</div>

I don’t know MMark, but I suggest that you post that in another thread, you are drifting from the original topic.
