Creating a .txt file at site root level using Netlify, for keybase authentication

I wanted to authenticate my site with keybase, which requires uploading a keybase.txt file to my-site/keybase.txt

I’m deploying using Netlify (otherwise I could just add it after hugo does its thing to the generated site in /public).

This is how I’m using Hugo to automatically create the file:

1: Create a new output format in my config file:

      baseName = "keybase"
      isPlainText = true
      mediaType = "text/plain"
      isHTML = false

2: Create a file with the text that needs to go in the keybase.txt file, with the front matter:
This is saved as /content/

title = "keybase"
date = "2018-03-20"
outputs = "PlainTextFile"
---- paste in keybase authentication text here ----

3: Create a new layout file to funnel the contents of the through as plain text without markdown. This is saved as /layouts/_text/_default/single.txt

{{ .Plain }}

4: Now everything is working when Hugo is serving locally - I am getting a keybase.txt file generated at the root level of the public folder so all seems good there. But I thought I should make sure and tell Netlify to use a version of Hugo that definitely supports these new custom output formats:

As per their docs, I added a HUGO_VERSION environment variable to the build, and set it to 0.38.1, the same version that is building a keybase.txt file fine locally

aaaaaand it doesn’t work… help! :smile:

Netlify is reporting that it can’t find the layout file:

3:33:41 PM: WARN 2018/05/21 19:33:41 [en] Unable to locate layout for "page": [_text/PlainTextFile/single.en.plaintextfile.txt _text/theme/PlainTextFile/single.en.plaintextfile.txt _text/PlainTextFile/single.plaintextfile.txt _text/theme/PlainTextFile/single.plaintextfile.txt _text/PlainTextFile/single.en.txt _text/theme/PlainTextFile/single.en.txt _text/PlainTextFile/single.txt _text/theme/PlainTextFile/single.txt _text/_default/single.en.plaintextfile.txt _text/theme/_default/single.en.plaintextfile.txt _text/_default/single.plaintextfile.txt _text/theme/_default/single.plaintextfile.txt _text/_default/single.en.txt _text/theme/_default/single.en.txt _text/_default/single.txt _text/theme/_default/single.txt]

Can anyone shed light on what’s going on? I’m not getting any build errors locally so I’m a bit at a loss. Thanks :slight_smile:

1 Like

I think you could just add the keybase.txt file to the static folder and hugo will copy it to the site root.


It doesn’t have to be that complicated. As @polymer said, simply pasting the keybase txt file in static/ suffices (I have done the same).

1 Like

:woman_facepalming: but also :tada: - thanks people!

(Can I count it as a win anyway because I know more about Hugo than when I started…? Yeah? Ok…)


Yeah! In fact, if we changed it from “keybase auth” to “arbitrary text output”, it is one of the most solid examples I’ve seen. So good job! :slight_smile: