Problem after executing hugo --cleanDestinationDir


I faced an issue after I ran the following command while deploying.
hugo --cleanDestinationDir.
Before this, I just used to run hugo to build and deploy and it was all working fine.

After I ran this, I got an error message saying git crashed. So I deleted .git/index.lock file and ran hugo command again. The following is the error message.

Building sites … ERROR 2018/03/10 19:23:48 Unable to locate template for shortcode "staticref" in page "home/"

I tried to uninstall hugo and install again, and now I ran into a new problem.

I face the following problems.

  • Error: While parsing config: Near line 58 (last key parsed 'params.organizations'): Expected value but found '{' instead. Config.toml at line 58 reads the following
    organizations = [{ name = " ", url = " "} ]
  • I commented out line 58, and executed hugo again. Now, I get around 20 errors saying the following
    ERROR: 2018/03/10 19:56:50 page.go:833: Near line 6 (last key parsed 'date'): Expected 'T' in ISO8601 datetime, but found '\n' instead.

I would be glad if someone can help me regarding this. Thanks in advance.


Can you share the source?

Are those template files still present ?

What was your destinationDir?


@bep do you know if the --cleanDestinationDir argument conflicts with the destination dir being a Git repo or git sub-module directory (e.g. in the case where public/ is a git repo or git sub-module for GitHub Pages)? It sounds like there may possibly be a bug with it removing the .git sub-module folder in the above case…


I am extremely sorry, I am completely new to Hugo. What do you mean by source, and where to find those template files?
I guess destination dir is public/ which was created as a git submodule.


Sorry @JayanthRR I should have been more clear.

Source refers to the files you used to produce the site. The only way I see this happening so far, is if your source was also in the public/ directory.


Based on the posted errors, your site source send to have multiple issues:

  • You seen to have JSON-like curly braces in a TOML list in the config.toml.
  • One or more of your content pages has the date front-matter in invalid format.

As @brunoamaral said, you’ll need to share the complete source of your site (that includes the config.toml, content dir, layouts dir, themes for, etc, except the public dir), if you cannot debug and fix these issues.


@kaushalmodi @brunoamaral
I was away so I couldn’t reply earlier than this. I tried fixing some of those datetime errors, but there are way too many of those.
How do I share the entire folders (content, themes, etc) here? The upload option here only accepts images. Do you want me to zip it?


The most common way is to use git. If you haven’t yet used it, it’s an important life skill to learn :slight_smile:. Then commit and push to somewhere like GitHub or Gitlab.


Oh thanks. I was thinking if there is a way to share them here :slight_smile:. This is the link to my repository.


I took a quick look just now. From what I saw, instead of building the site in public/ it was built into the directory where the theme, config, and other source files where. That together with the cleanDestinationDir argument, deletes everything.

I would suggest reverting to a previous commit and try running hugo -d public_html/ and see how it goes.