Skip to content

Commit fdea7eb

Browse files
committed
feat(site): add favicon (closed green book, old notebook style)
SVG primary (favicon.svg) with PNG fallbacks for browsers/crawlers that don't support SVG favicons (favicon-32.png) and iOS home-screen icons (apple-touch-icon.png). Wired into the page shell template and copied alongside style.css by site-builder.gengo; verify-site.gengo asserts both the link tags and the built asset files are present.
1 parent ce9196b commit fdea7eb

5 files changed

Lines changed: 44 additions & 1 deletion

File tree

tools/site-builder/site-builder.gengo

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const srcDir := "root/docs"
2121
const outDir := "root/build/site"
2222
const staticDir := "root/tools/site-builder/static"
2323
const cssPath := "style.css"
24+
const staticAssets := ["favicon.svg", "favicon-32.png", "apple-touch-icon.png"]
2425
const siteBase := "https://docs.gengoscript.org/"
2526
const repoBlob := "https://github.com/gengoscript/gengo/blob/main/"
2627
// Keep this in sync with build.zig. The -dev suffix means this site documents
@@ -89,6 +90,9 @@ const pageShellSrc :=
8990
\\<meta name="description" content="{{.desc}}">
9091
\\<meta name="robots" content="index,follow,max-image-preview:large">
9192
\\<meta name="application-name" content="Gengoscript Documentation">
93+
\\<link rel="icon" href="favicon.svg" type="image/svg+xml">
94+
\\<link rel="icon" href="favicon-32.png" type="image/png" sizes="32x32">
95+
\\<link rel="apple-touch-icon" href="apple-touch-icon.png">
9296
\\<link rel="canonical" href="{{.canonical}}">
9397
\\<meta property="og:type" content="{{.ogType}}">
9498
\\<meta property="og:locale" content="en_US">
@@ -980,8 +984,11 @@ func main() {
980984
sitemap.write("</urlset>\n")
981985
fs.write(outDir + "/sitemap.xml", sitemap.str())
982986

983-
// Ship the stylesheet next to the pages.
987+
// Ship the stylesheet and favicon assets next to the pages.
984988
fs.write(outDir + "/" + cssPath, fs.read(staticDir + "/" + cssPath))
989+
for name in staticAssets {
990+
fs.write(outDir + "/" + name, fs.read(staticDir + "/" + name))
991+
}
985992
}
986993

987994
main()
1.9 KB
Loading
499 Bytes
Loading
Lines changed: 30 additions & 0 deletions
Loading

tools/site-builder/verify-site.gengo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ assert(fs.exists("root/build/site/index.html"))
3434
assert(not fs.exists("root/build/site/opcodes.html"))
3535
assert(fs.exists("root/dev-docs/opcodes.md"))
3636

37+
for name in ["favicon.svg", "favicon-32.png", "apple-touch-icon.png"] {
38+
assert(fs.exists("root/build/site/" + name))
39+
}
40+
3741
// Maintainer-audience audit material must stay contributor-only, not published.
3842
for name in ["documentation-inventory", "documentation-contradictions", "documentation-plan", "feature-matrix"] {
3943
assert(not fs.exists("root/build/site/" + name + ".html"))
@@ -52,6 +56,8 @@ for page in fs.list("root/build/site") {
5256
assert(str.contains(html, "<span class=\"doc-version\">0.5.1-dev"))
5357
assert(str.contains(html, "<p class=\"doc-status\">Documentation status: main branch / unreleased"))
5458
assert(str.contains(html, "<meta name=\"robots\" content=\"index,follow,max-image-preview:large\">"))
59+
assert(str.contains(html, "<link rel=\"icon\" href=\"favicon.svg\""))
60+
assert(str.contains(html, "<link rel=\"apple-touch-icon\" href=\"apple-touch-icon.png\">"))
5561
assert(str.contains(html, "<meta property=\"og:locale\" content=\"en_US\">"))
5662
assert(str.contains(html, "<script type=\"application/ld+json\">"))
5763
assert(str.contains(html, "https://schema.org"))

0 commit comments

Comments
 (0)