Getting the .File.Dir error in the docdock theme

Hello Hugo Gurus!

I inherited a hugo site built with the docdock theme, here’s a screenshot of the themes dir:

Complete error output from the Hugo build commands >hugo -D and >hugo
Start building sites …
WARN 2021/04/14 13:36:26 .File.BaseFileName on zero object. Wrap it in if or with: {{ with .File }}{{ .BaseFileName }}{{ end }}
WARN 2021/04/14 13:36:26 .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
WARN 2021/04/14 13:36:26 .File.LogicalName on zero object. Wrap it in if or with: {{ with .File }}{{ .LogicalName }}{{ end }}

                   | EN
  Pages            |  44
  Paginator pages  |   0
  Non-page files   | 141
  Static files     | 209
  Processed images |   0
  Aliases          |   2
  Sitemaps         |   1
  Cleaned          |   0

Total in 767 ms

Any ideas, as I searched, I found a solution for the hugo-book theme, but I dont see how to apply that to this theme. Any help would greatly appreciated.


The docDock theme was removed from the Hugo Themes site some time ago. It is no longer actively maintained.

A screen capture of your project directory is insufficient to troubleshoot the problem.


Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Thanks @jmooring joe - I am unable to convert the repo from Private, as I said I just inherited the site at work, and I am new to Hugo.

I’ll see if I can migrate it to a public repo to share. I noticed that docdock had not been updated in git for 4+ years… so the next conversation will be to find a new theme. It’s strange, because I ran an update a couple of weeks ago, my first time using Hugo, and I didnt have the issue. So I am not sure what would have changed all of a sudden to stop working.

I’ll see what I can do.


When I had to adapt this theme for the Hugo v0.55 (for those warning) it was:


-	{{if eq .Page.File.BaseFileName "_index"}}
-		{{$.Scratch.Add "filesName" "files"}}
-	{{else}}
-		{{$.Scratch.Add "filesName" (printf "%s.files" .Page.File.BaseFileName)}}
-	{{end}}
+	{{ with .Page.File }}
+		{{if eq .BaseFileName "_index"}}
+			{{$.Scratch.Add "filesName" "files"}}
+		{{else}}
+			{{$.Scratch.Add "filesName" (printf "%s.files" .BaseFileName)}}
+		{{end}}
+	{{ end }}

It is only a warning. Should not stop working. And I see that you have a success report.

@divinerites oh - I thought the errors being thrown indicated it failed to complete. I’ll upload and test it in the morning. Thanks!