No static files after Hugo Update from 0.41 to 0.42.1

#1

After Update Hugo from 0.41 to 0.42.1 the static files are missing.
Hugo Static Site Generator v0.42.1 linux/amd64 BuildDate: 2018-06-13T10:16:36Z

I changed nothing on my Page. I would only update Hugo. The Page error is on my multilanguage page. On my single language Page the Update works fine.

Build with Hugo 0.42.1

     | EN | DE  

±-----------------±—±---+
Pages | 17 | 17
Paginator pages | 0 | 0
Non-page files | 0 | 0
Static files | 0 | 0
Processed images | 0 | 0
Aliases | 0 | 0
Sitemaps | 1 | 1
Cleaned | 0 | 0

Build with Version 0.41

  | EN | DE  

±-----------------±—±---+
Pages | 17 | 17
Paginator pages | 0 | 0
Non-page files | 0 | 0
Static files | 22 | 22
Processed images | 0 | 0
Aliases | 0 | 0
Sitemaps | 1 | 1
Cleaned | 0 | 0

#2

Ah, it is probably a matter of version provision corruption on the static core. Pre-clearing caches across the base domain should fix your…

NAH! Just kidding. We can’t know what is happening without seeing your code! Please read Requesting Help and post a repo so someone can help ya. :slight_smile:

1 Like
#4

Thank you for the answer. Here is the Repo,

https://gitlab.com/kwpse/homepage

Built with version 0.41 there are no problems

#5

Maybe the error is in my config.toml?

title = "Example"
languageCode = "en-us"

contentDir = "content"
layoutDir = "layouts"
publishDir = "public"

enableRobotsTXT = "true"

theme = "home"
canonifyurls = true
disableKinds = ["taxonomy", "taxonomyTerm"]

[sitemap]
    ChangeFreq = "weekly"
    Priority = ".5"

[params]
    # General information
    author = ""
    description = "Website"
    publisher = "example.com"
    copyright = "example.com"

    # Repository
    provider = "GitLab"
    repo_url = "https://gitlab.com//example/homepage"

    version = "0.1.0"
    logo = "images/Logo-Standard.jpg"

    # Fonts
    googlefonts = [
        "Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic",
        "Roboto+Mono:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic"
        ]

# Language configuration
defaultContentLanguage = "de"
defaultContentLanguageInSubdir = true

[languages]
    [languages.en]
        baseURL = "https://example.com/"
        languageName = "Englisch"
        languageCode = "en-us"
        contentDir = "content/en"

    [languages.de]
        baseURL = "https://example.de/"
        languageName = "German"
        languageCode = "de-de"
        contentDir = "content/de"
#6

After a conversation with @bep the config.toml is no valid. I changed some lines but the error is still alive.
Please help me to find the error. I am not the only one with a multilingual page here.

Your config.toml isn’t valid TOML, which may or may not be the cause of this. Only maps can follow another map.

You need to move the “defaultContentLanguage*” settings near the top (above the maps/dicitonaries)

[languages]
The above starts a map definition.
theme = “home”
The above is a single property. That and similar need to be above all maps definition.
Take further questions/trouble shooting on https://discourse.gohugo.io/

We can bring it back here if it is a real bug.

title = "Company"
languageCode = "en-us"

theme = "homepage"

# Language configuration
defaultContentLanguage = "de"
defaultContentLanguageInSubdir = true

[languages]
    [languages.en]
        baseURL = "https://example.com/"
        languageName = "Englisch"
        languageCode = "en-us"
        contentDir = "content/en"

    [languages.de]
        baseURL = "https://example.de/"
        languageName = "German"
        languageCode = "de-de"
        contentDir = "content/de"

canonifyurls = true
disableKinds = ["taxonomy", "taxonomyTerm"]

enableRobotsTXT = true

[sitemap]
    ChangeFreq = "weekly"
    Priority = ".5"

[params]
    # General information
    author = "Example"
    description = "Example"
    publisher = "example.com"
    copyright = "Example"

    # Repository
    provider = "GitLab"
    repo_url = "https://gitlab.com//example/homepage"

    version = "0.1.0"
    logo = "images/Logo-Standard.jpg"

    # Fonts
    googlefonts = [
        "Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic",
        "Roboto+Mono:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic"
        ]
#7

Ok, so easy things first:

That means anything that doesn’t belong under [these] should go before the first of [these] are defined:

title = "KWP-Klein Wertpapierhandel GmbH"
languageCode = "en-us"

contentDir = "content"
layoutDir = "layouts"
publishDir = "public"
staticDir = "static"
enableRobotsTXT = "true"

theme = "kwpse"
canonifyURLs = true
disableKinds = ["taxonomy", "taxonomyTerm"]

# Language configuration
defaultContentLanguage = "de"
defaultContentLanguageInSubdir = true

[sitemap]
    ...
[params]
    ...
[languages]
    [languages.en]
        ...
    [languages.de]
        ...

Now the difficult bit:

I don’t have a multilingual setup myself, but FWIW the static files seem to disappear when baseURLs are set in languages.

[languages]
    [languages.en]
        baseURL = "https://kwpse.com/" 
        ...
    [languages.de]
        baseURL = "https://kwpse.de/"
        ...

I’m not sure how to fix it, but I hope this helps someone else help you.

#8

In the docs you can find this example for the baseURL

[languages]
  [languages.en]
    baseURL = "https://example.com"
    languageName = "English"
    title = "In English"
    weight = 2
  [languages.no]
    baseURL = "https://example.no"
    languageName = "Norsk"
    title = "På norsk"
    weight = 1
#9

Here all the log files together.

After Update Hugo from 0.41 to 0.42.1 the static files are missing.
Hugo Static Site Generator v0.42.1 linux/amd64 BuildDate: 2018-06-13T10:16:36Z

I changed nothing on my Page. I would only update Hugo. The Page error is on my multi language page. On my single language Page the Update works fine. The Repo is not public. Please send me am PM, then I
give you access. I am a gitlab user

Build with Hugo 0.42.1

[user@tobbie homepage]$ hugo server -vvv
WARN 2018/06/19 07:27:24 No translation bundle found for default language "de"
WARN 2018/06/19 07:27:24 Translation func for language en not found, use default.
WARN 2018/06/19 07:27:24 i18n not initialized, check that you have language file (in i18n) that matches the site language or the default language.
WARN 2018/06/19 07:27:24 Translation func for language de not found, use default.
WARN 2018/06/19 07:27:24 i18n not initialized, check that you have language file (in i18n) that matches the site language or the default language.
INFO 2018/06/19 07:27:24 Using config file: /home/user/Projects/homepage/config.toml
Building sites … INFO 2018/06/19 07:27:24 syncing static files to /en
WARN 2018/06/19 07:27:24 No Static directory found
INFO 2018/06/19 07:27:24 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2018/06/19 07:27:24 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}

                   | EN | DE  
+------------------+----+----+
  Pages            | 21 | 17  
  Paginator pages  |  0 |  0  
  Non-page files   |  0 |  0  
  Static files     |  0 |  0  
  Processed images |  0 |  0  
  Aliases          |  0 |  0  
  Sitemaps         |  1 |  1  
  Cleaned          |  0 |  0  

Total in 47 ms
Watching for changes in /home/user/Projects/homepage/{content,layouts,themes}
Watching for config changes in /home/user/Projects/homepage/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Web Server is available at http://localhost:1314/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Here the config.toml

title = "Company"
languageCode = "en-us"

theme = "example"

contentDir = "content"
layoutDir = "layouts"
publishDir = "public"
staticDir = "static"

canonifyurls = true

enableRobotsTXT = "true"

defaultContentLanguage = "de"
defaultContentLanguageInSubdir = true

[languages]
  [languages.en]
  baseURL = "https://example.com/"
  languageName = "Englisch"
  languageCode = "en-us"
  contentDir = "content/en"

  [languages.de]
  baseURL = "https://example.de/"
  languageName = "German"
  languageCode = "de-de"
  contentDir = "content/de"

disableKinds = [
  "taxonomy",
  "taxonomyTerm"
]

[sitemap]
    ChangeFreq = "weekly"
    Priority = ".5"

[params]
    author = "Example"
    description = "Website"
    publisher = "example.com"
    copyright = "Example"

    provider = "GitLab"
    repo_url = "https://gitlab.com//example/homepage"

    version = "0.1.0"
    logo = "images/Logo-Standard.jpg"

googlefonts = [
  "Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic",
  "Roboto+Mono:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic"
]

Build with Hugo 0.41

[user@tobbie homepage]$ hugo server -vvv
INFO 2018/06/19 07:37:32 Using config file: /home/user/Projects/homepage/config.toml
Building sites … WARN 2018/06/19 07:37:32 Unable to find Static Directory: /home/user/Projects/homepage/static/
INFO 2018/06/19 07:37:32 syncing static files to /en
WARN 2018/06/19 07:37:32 No translation bundle found for default language "de"
WARN 2018/06/19 07:37:32 Translation func for language en not found, use default.
WARN 2018/06/19 07:37:32 i18n not initialized, check that you have language file (in i18n) that matches the site language or the default language.
WARN 2018/06/19 07:37:32 Unable to find Static Directory: /home/user/Projects/homepage/static/
INFO 2018/06/19 07:37:32 syncing static files to /de
WARN 2018/06/19 07:37:32 Translation func for language de not found, use default.
WARN 2018/06/19 07:37:32 i18n not initialized, check that you have language file (in i18n) that matches the site language or the default language.
INFO 2018/06/19 07:37:32 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
INFO 2018/06/19 07:37:32 found taxonomies: map[string]string{"category":"categories", "tag":"tags"}

                   | EN | DE  
+------------------+----+----+
  Pages            | 21 | 17  
  Paginator pages  |  0 |  0  
  Non-page files   |  0 |  0  
  Static files     | 22 | 22  
  Processed images |  0 |  0  
  Aliases          |  0 |  0  
  Sitemaps         |  1 |  1  
  Cleaned          |  0 |  0  

Total in 71 ms
WARN 2018/06/19 07:37:32 Skip dataDir: lstat /home/user/Projects/homepage/data: no such file or directory
WARN 2018/06/19 07:37:32 Skip i18nDir: lstat /home/user/Projects/homepage/i18n: no such file or directory
WARN 2018/06/19 07:37:32 Skip staticDir: lstat /home/user/Projects/homepage/static/: no such file or directory
Watching for changes in /home/user/Projects/homepage/{content,layouts,themes}
Watching for config changes in /home/user/Projects/homepage/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Web Server is available at http://localhost:1314/ (bind address 127.0.0.1)
Press Ctrl+C to stop
#10

@Joerg, have you tried 0.42.1 without multilingual support? I would try that. If it suddenly works, then it is a language config thing, but if not maybe it is something else.

#11

Yes I have some other Hugo projects with only one language, The Update works fine. Why works the multi language page with Version 0.41 and not with 0.42.x? I have changed nothing. The question is what changes were made in the Hugo code? I hope in the next updates the problem will be fixed.

#12

I am experiencing the same problem.

I have a multilingual site configured with two languages in a Multilingual Multihost configuration.
It worked fine when i was using version 40.2. After my upgrade to 42.1, the site ignores the ‘static’ directory in my theme. If i remove the multilingual configuration, it builds fine.

It seems to be a newly introduced bug, but there may of course be something smart i am missing.

#13

I managed to work around the problem by hardcoding my theme’s static directory into to my config.toml.

staticDir = ["static","themes/crypho/static"]

This does not at all seem like a correct thing to do, but solves the problem temproarily for me, until we figure out how to fix it correctly.

1 Like
#14

Since you can specify static directories per language now per:

… perhaps this is a matter of simply not specifying static in the general section, then?

I’ve got one static in this site and am simply not specifying it in config.toml. It’s working for me:

#15

This does not seem to solve it.

When i remove the ´staticDir´ directive, it returns to the erronous behaviour:

It includes the static directory for the site, but ignores the one from the theme.

#16

Ok, the difference in my situation is, I’m not using a theme. Maybe your solution is the way to solve it, @baekholt. Maybe we need to always include something like staticDir = ["static","themes/crypho/static"] if you’re using a theme…

#17

Well that fixes my issue for now, bt it seems very inflexible for those that work with multiple themes.

What puzzles me is that this worked perfectly fine on version 40.2, but started breaking after I upgraded.

#18

If you’re clear on what happened and when, maybe make a Github issue to flag it.

Static theme file is not copied to public when built with newer versions of hugo
#19

Yes. I am not familiar with the codebase, so I cannot tell where it was introduced. I just know between 40.2 and 42.0. I will try to file an issue. Thanks :slight_smile:

#20

Hello there. I run into this problem too.
Have you managed to file an issue? I’d like to subscribe to it.

#21

It’s now solved in 0.44.

1 Like