Sharing page bundles in multilingual mode

I have a question on the page bundles in i18n mode.
Assume that we have a directory structure as follows:

├── english
│   └── testpost
│       ├──
│       └── cat.jpg
└── french
    └── testpost

Then even though we don’t have the “cat.jpg” file in “french” langauge version, hugo will search the same file in other language directory depending on the weight parameter so following markdown will print correct cat image.


 title: "French page"
 French page
 ![cat image here](cat.jpg)

But the problem is that, if we build the actual site, then the image gets duplicated for each language version. So the final public directory after building process looks like

    ├── en
    │   └── posts
    │        └── testpost
    │             ├── index.html
    │             └── cat.jpg
    └── fr
        └── posts
             └── testpost
                  ├── index.html
                  └── cat.jpg

You can see that “cat.jpg” file is copied for both languages.
Is there any way not generating the shared page bundles? I mean, since there is no cat.jpg file in French version of source file, then the output image tag should be something like

<img src="/en/posts/testpost/cat.jpg">

but not

<img src="/fr/posts/testpost/cat.jpg">

, so we do not copy same file.


I don’t know the theme that you are using, but there is no need for you to save your cat.jpg in the content directory. You can store it in your static directory.

In your static directory, first create a folder called img (it could have any name). Save all your favourite cat photos here.

Your markdown code should look like this:

title: "French page"
 French page
 ![alt text](/img/cat.jpg)
title: "English page"
 English page
 ![alt text](/img/cat.jpg)

You don’t need to worry about the duplications as the pictures are stored in the static directory.

Hope this helps!

Mithun K