Where Is Hugo
It's Alive
Hugo + Markdown
If you've spent much time in the programming space, Markdown. It's a great lightweight approach to structuring a document. You can choose your own adventure when it comes to level of structure, and that lends itself nicely to the world of blogging. Because it's essentially a template DSL, it's relatively easy to go from MD --> HTML. But I'm getting way ahead of myself, so let me back up.
How Did You Get Here?
If the answer is "...entered https://iguessthatworks.com in the browser..." you're as correct as you need to be. But, I still had questions about this magical flow. I highly recommend Julia Evans' How DNS Works zine, or for that matter anything that's been posted by Julia. But there was something even more interesting to me about how this Azure Static Web App goes from some server in Azure to a browser.
It will take a few rambling posts to get there, but this one will cover a bit of the magic behind a TXT DNS Record.
Key Pieces
Used to register and manage a Domain. In this case I've registered iguessthatworks.com allowing the management of DNS Records for it
A table of data about a Domain, including details such as where to look for iguessthatworks.com
Used to lookup who is the authoritative keeper of where to find the pot of gold at the end of the iguessthatworks.com
- Truck sized -well-I-guess-we-can-
The TXT DNS Record is a way to associate a block of text with a Domain. Originally designed to be read by humans, it's become a way to perform a secret handshake between a Domain Registrar and a Host
Welcome
The key here is the TXT DNS Record, but there are a few precursors I'll try to cover in other posts including:
- Walking through setting up a basic (Hugo) site
- Writing the first post
- Updating to use the Clarity Theme
- Creating an Azure Static Web App to create a blog
- Registering a Domain
That's a whole lot of things, and there's quite a few steps in each part, but I'm jumping ahead a bit to the Map an existing custom DNS name to Azure. Specifically the Validate part of the flow.
I found this step deeply satisfying, as it's one of the many times where a technology/protocol/strategy/other capability has be repurposed for something likely more useful than it's original intent. Let's start by reading a few TXT records.
dig is a very useful tool for looking up DNS information about a domain. From unwinding CNAME chains, to troubleshooting resolution issues, this is a great tool to get familiar with. We'll use it to read some TXT records for well known domains. Let's start by looking at the command.
dig @1.1.1.1 +ignore +short +bufsize=1024 <domain> txt
dig
- this is the command line tool we'll use@1.1.1.1
- this is a DNS server I want to ask about the txt record. This can be omitted and it will use the server configured for your network+ignore
- skip any cached data+short
- give me the good stuff only, just the record. This can be omitted, you'll just see additional details returned+bufsize=1024
- can help with longer messages. This can be omitted, you may get a truncated response, but that is unlikely<domain>
- which domain do I want to query abouttxt
- the record type to query. You can query other types likea
orcname
to see what you get
Bing
1> dig @1.1.1.1 +ignore +short +bufsize=1024 bing.com txt
2"facebook-domain-verification=09yg8uzcfnqnlqekzsbwjxyy8rdck7"
3"google-site-verification=OkRY8R261shK5B8uEwvsFZp9nQ2gRoHavGlruok1azc"
4"v=msv1 t=6097A7EA-53F7-4028-BA76-6869CB284C54"
5"v=spf1 include:spf.protection.outlook.com -all"
1> dig @1.1.1.1 +ignore +short +bufsize=1024 google.com txt
2"globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="
3"docusign=1b0a6754-49b1-4db5-8540-d2c12664b289"
4"google-site-verification=wD8N7i1JTNTkezJ49swvWW48f8_9xveREV4oB-0Hf5o"
5"apple-domain-verification=30afIBcvSuDV2PLX"
6"v=spf1 include:_spf.google.com ~all"
7"onetrust-domain-verification=de01ed21f2fa4d8781cbc3ffb89cf4ef"
8"docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e"
9"google-site-verification=TV9-DBe4R80X4v0M4U_bd_J9cpOJM0nikft0jAgjmsQ"
10"webexdomainverification.8YX6G=6e6922db-e3e6-4a36-904e-a805c28087fa"
11"facebook-domain-verification=22rm551cu4k0ab0bxs
Okay, so that's neat, but why is that useful here. In this case I'm using the TXT record to prove to Azure that I am the true owner of the domain.
- Azure provides me with a generated key
- I add that to a TXT record in the GoDaddy Domain Control Admin
- Azure reads the TXT record and verifies the data
- Azure allows me to point the iguessthatworks.com Domain to the static web app I've already created
It's this repurposing of a technology that allows technical hobbyists like myself stitch together the various pieces of creating a blog and finding a way to make it eas(ier) to find. In the many years I've been playing at being a developer, it's this kind of innovative "maybe if we just..." type of solutions that bring me the most joy.
Writing software is often repetitive, even with de-boilerplating tools like Github Copilot, there is a lot of sameness across all of the projects you get to work on. Encountering a short-cut like this TXT record approach, is like an inside joke, it makes me chuckle, and appreciate the way we're all just trying to make something work.
While this was only a few minutes in the flow of creating this blog, it's definitely something I want to file away. Sometimes we need to look at the tools we have, and maybe at least for this case use that screwdriver as a hammer, despite what we were told by our elders.
QOTD
“I have never let my schooling interfere with my education.” ― Mark Twain