Skip to content

Multilingual content resources are built even if the page is a draft #13998

@mikyll

Description

@mikyll

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.150.0-3f5473b7d4e7377e807290c3acc89feeef1aaa71+extended linux/amd64 BuildDate=2025-09-08T13:01:12Z VendorInfo=snap:0.150.0

Version v0.150.0

Does this issue reproduce with the latest release?

Yes

Issue Description

When building localized draft content, resources (e.g. an image) still get built.

TL;DR Example

I have a draft content content/my-blog-post/. This contains the following files:

  • Content markdown file content/my-blog-post/index.it.md
  • An image content/my-blog-post/gfx/red.jpg
---
title: "Test Localized Draft"
draft: true
---

# Localized Draft (IT)

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

![](gfx/red.jpg)

If I build the website, I can clearly see that under public/ there's not the HTML page for my-blog-post, as expected. However, the image is present at public/my-blog-post/gfx/red.jpg.

Below is a more complete example to reproduce the issue.

Example (MRE)

  1. Setup quickstart:

    hugo new site .
  2. Clone a theme:

    git clone https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
  3. Update hugo.yaml:

    baseURL: "/"
    languageCode: en-us
    theme: "ananke"
    
    params:
      defaultContentLanguage: "en"
    
      languagesDir: "i18n"
    
    languages:
      en: {}
      it: {}
  4. Write some draft content, placing an image under gfx/ (such as this: red.jpg:

    • Draft content in default language:

      • content/test-en-draft/gfx/red.jpg

      • content/test-en-draft/index.md:

        ---
        title: "Test English Draft"
        draft: true
        ---
        
        # English Draft
        
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        
        ![](gfx/red.jpg)
    • Draft content in a secondary language (e.g. it):

      • content/test-it-draft/gfx/red.jpg

      • content/test-it-draft/index.it.md:

        ---
        title: "Test Italian Draft"
        draft: true
        ---
        
        # Italian Draft
        
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        
        ![](gfx/red.jpg)
    • Draft content with multiple languages (e.g. default and it):

      • content/test-multi-draft/gfx/red.jpg

      • content/test-multi-draft/index.md:

        ---
        title: "Test MultiLanguage Draft (EN)"
        draft: true
        ---
        
        # MultiLanguage Draft (EN)
        
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        
        ![](gfx/red.jpg)
      • content/test-multi-draft/index.it.md:

        ---
        title: "Test MultiLanguage Draft (IT)"
        draft: true
        ---
        
        # MultiLanguage Draft (IT)
        
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        
        ![](gfx/red.jpg)
  5. Run Hugo:

    hugo server --disableFastRender --cleanDestinationDir --gc --ignoreCache
  6. Have a look at the generated pages:

    tree public
    public
    ├── 404.html
    ├── ananke
    │   └── css
    │       ├── main.css.map
    │       └── main.min.css
    ├── categories
    │   ├── index.html
    │   └── index.xml
    ├── en
    │   ├── index.html
    │   └── sitemap.xml
    ├── images
    │   └── gohugo-default-sample-hero-image.jpg
    ├── index.html
    ├── index.xml
    ├── it
    │   ├── 404.html
    │   ├── categories
    │   │   ├── index.html
    │   │   └── index.xml
    │   ├── index.html
    │   ├── index.xml
    │   ├── sitemap.xml
    │   └── tags
    │       ├── index.html
    │       └── index.xml
    ├── sitemap.xml
    ├── tags
    │   ├── index.html
    │   └── index.xml
    └── test-it-draft
        └── gfx
            └── red.jpg <-- Why?
    
    12 directories, 22 files

Question

Is this behaviour intended/expected? Am I missing something or configuring localization wrongly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions