Skip to content

Commit 3b50eac

Browse files
oschwaldclaude
andcommitted
Add Hugo-based docs site
Build with `mise run build-docs`, preview with `mise run serve-docs`. The site mounts the existing `doc/libmaxminddb.md` and `doc/mmdblookup.md` as Hugo content so the source of truth stays in one place. A small pill nav lets readers move between the two pages. CSS is inlined in the layout template — no external dependencies. Same Charter serif + forest-green design as the MaxMind-DB spec site. For STF-448. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent de841c3 commit 3b50eac

6 files changed

Lines changed: 354 additions & 19 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*~
1010
.\#*
1111
.gh-pages
12+
docs/.hugo_build.lock
13+
docs/public/
1214
/INSTALL
1315
/autom4te.cache
1416
/bin/country_lookup

docs/hugo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
title = "libmaxminddb"
2+
disableKinds = ["taxonomy"]
3+
4+
[[cascade]]
5+
layout = "default"
6+
7+
[markup.highlight]
8+
noClasses = true
9+
style = "github"
10+
11+
[[module.mounts]]
12+
source = "../doc/libmaxminddb.md"
13+
target = "content/_index.md"
14+
15+
[[module.mounts]]
16+
source = "../doc/mmdblookup.md"
17+
target = "content/mmdblookup.md"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h{{ .Level }} id="{{ .Anchor }}">
2+
{{- .Text | safeHTML -}}
3+
<a class="heading-anchor" href="#{{ .Anchor }}" aria-label="Link to {{ .PlainText }}">#</a>
4+
</h{{ .Level }}>

docs/layouts/_default/default.html

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
{{- $title := or .Title .File.BaseFileName -}}
7+
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title>
8+
<style>
9+
:root {
10+
--fg: #2d2d2d;
11+
--bg: #faf9f7;
12+
--accent: #1a6b50;
13+
--accent-soft: rgba(26, 107, 80, 0.06);
14+
--border: #d5d0c8;
15+
--code-bg: #f0eeea;
16+
--heading: #1a1a1a;
17+
--muted: #70695f;
18+
}
19+
20+
::selection {
21+
background: rgba(26, 107, 80, 0.15);
22+
}
23+
24+
*,
25+
*::before,
26+
*::after {
27+
box-sizing: border-box;
28+
}
29+
30+
body {
31+
font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, serif;
32+
font-size: 1.05rem;
33+
line-height: 1.78;
34+
color: var(--fg);
35+
background: var(--bg);
36+
max-width: 50rem;
37+
margin: 0 auto;
38+
padding: 3rem 1.5rem 5rem;
39+
}
40+
41+
h1,
42+
h2,
43+
h3,
44+
h4 {
45+
font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial,
46+
sans-serif;
47+
line-height: 1.35;
48+
}
49+
50+
h1 {
51+
font-size: 1.75rem;
52+
font-weight: 800;
53+
color: var(--heading);
54+
margin: 0 0 1.5rem;
55+
padding-bottom: 0.75rem;
56+
border-bottom: 3px solid var(--accent);
57+
}
58+
59+
h2 {
60+
font-size: 1.3rem;
61+
font-weight: 700;
62+
color: var(--heading);
63+
margin: 3rem 0 0.75rem;
64+
padding-bottom: 0.4rem;
65+
border-bottom: 1px solid var(--border);
66+
}
67+
68+
h3 {
69+
font-size: 1.05rem;
70+
font-weight: 700;
71+
color: var(--accent);
72+
margin: 2.5rem 0 0.5rem;
73+
padding: 0.4rem 0.75rem;
74+
border-left: 3px solid var(--accent);
75+
background: linear-gradient(
76+
135deg,
77+
var(--accent-soft),
78+
transparent 80%
79+
);
80+
border-radius: 0 3px 3px 0;
81+
}
82+
83+
h4 {
84+
font-size: 0.92rem;
85+
font-weight: 700;
86+
color: var(--muted);
87+
margin: 2rem 0 0.5rem;
88+
padding-bottom: 0.2rem;
89+
border-bottom: 1px dashed var(--border);
90+
}
91+
92+
p {
93+
margin: 0.8rem 0;
94+
}
95+
96+
a {
97+
color: var(--accent);
98+
text-decoration-thickness: 1px;
99+
text-underline-offset: 2px;
100+
transition: text-decoration-thickness 0.15s;
101+
}
102+
103+
a:hover {
104+
text-decoration-thickness: 2px;
105+
}
106+
107+
strong {
108+
color: var(--heading);
109+
font-weight: 700;
110+
}
111+
112+
ol,
113+
ul {
114+
padding-left: 1.75rem;
115+
}
116+
117+
li + li {
118+
margin-top: 0.3rem;
119+
}
120+
121+
code {
122+
font-family: "JetBrains Mono", "Cascadia Code", Menlo, Consolas,
123+
monospace;
124+
font-size: 0.88em;
125+
background: var(--code-bg);
126+
padding: 0.15em 0.4em;
127+
border-radius: 3px;
128+
border: 1px solid rgba(0, 0, 0, 0.06);
129+
}
130+
131+
pre {
132+
background: var(--code-bg);
133+
border: 1px solid var(--border);
134+
border-radius: 5px;
135+
padding: 1rem 1.25rem;
136+
overflow-x: auto;
137+
line-height: 1.55;
138+
}
139+
140+
pre code {
141+
background: none;
142+
padding: 0;
143+
border: none;
144+
font-size: 0.85em;
145+
}
146+
147+
img {
148+
max-width: 100%;
149+
height: auto;
150+
}
151+
152+
.heading-anchor {
153+
opacity: 0;
154+
margin-left: 0.3em;
155+
font-weight: 400;
156+
text-decoration: none;
157+
transition: opacity 0.15s;
158+
}
159+
160+
h1:hover .heading-anchor,
161+
h2:hover .heading-anchor,
162+
h3:hover .heading-anchor,
163+
h4:hover .heading-anchor,
164+
.heading-anchor:focus {
165+
opacity: 0.4;
166+
}
167+
168+
.heading-anchor:hover {
169+
opacity: 1;
170+
}
171+
172+
.page-nav {
173+
margin-bottom: 2.5rem;
174+
display: flex;
175+
gap: 0.5rem;
176+
flex-wrap: wrap;
177+
}
178+
179+
.page-nav a {
180+
font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial,
181+
sans-serif;
182+
font-size: 0.85rem;
183+
font-weight: 600;
184+
text-decoration: none;
185+
color: var(--muted);
186+
padding: 0.3rem 0.75rem;
187+
border: 1px solid var(--border);
188+
border-radius: 999px;
189+
transition: color 0.15s, border-color 0.15s, background 0.15s;
190+
}
191+
192+
.page-nav a:hover {
193+
color: var(--accent);
194+
border-color: var(--accent);
195+
}
196+
197+
.page-nav a.active {
198+
color: var(--bg);
199+
background: var(--accent);
200+
border-color: var(--accent);
201+
}
202+
</style>
203+
</head>
204+
<body>
205+
<nav class="page-nav">
206+
<a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active" aria-current="page"{{ end }}>{{ .Site.Title }}</a>
207+
{{ range .Site.RegularPages }}
208+
<a href="{{ .RelPermalink }}"{{ if eq $.RelPermalink .RelPermalink }} class="active" aria-current="page"{{ end }}>{{ or .Title .File.BaseFileName }}</a>
209+
{{ end }}
210+
</nav>
211+
<main>
212+
{{ .Content }}
213+
</main>
214+
</body>
215+
</html>

0 commit comments

Comments
 (0)