From c71d0634dc25bc5d6d8626b342dde84c59c7b204 Mon Sep 17 00:00:00 2001 From: monsterlag <64719697+monsterlag@users.noreply.github.com> Date: Thu, 22 Oct 2026 12:00:48 +0000 Subject: [PATCH 1/2] Add blacksmith logo as site favicon --- _includes/head.html | 2 ++ tests/test_site.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/test_site.py diff --git a/_includes/head.html b/_includes/head.html index a1cd4a4b5..536944453 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -11,6 +11,8 @@ + + diff --git a/tests/test_site.py b/tests/test_site.py new file mode 100644 index 000000000..edfd4fb66 --- /dev/null +++ b/tests/test_site.py @@ -0,0 +1,42 @@ +"""Tests for shared website templates.""" + +import unittest +from html.parser import HTMLParser +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent + + +class IconParser(HTMLParser): + """Collect favicon links from HTML.""" + + def __init__(self): + """Initialize the parser.""" + super().__init__() + self.icons = [] + + def handle_starttag(self, tag, attrs): + """Record links whose relation includes icon.""" + attrs = dict(attrs) + if tag == "link" and "icon" in (attrs.get("rel") or "").split(): + self.icons.append(attrs) + + +class TestSite(unittest.TestCase): + """Test the shared website head.""" + + def test_favicon(self): + """Test that the favicon uses the existing blacksmith PNG.""" + parser = IconParser() + parser.feed(ROOT.joinpath("_includes", "head.html").read_text()) + self.assertEqual(1, len(parser.icons), msg="Missing shared favicon link") + icon = parser.icons[0] + self.assertEqual("image/png", icon.get("type")) + self.assertEqual("/images/foundrylogo.png", icon.get("href")) + image = ROOT.joinpath(icon["href"].lstrip("/")) + self.assertEqual(b"\x89PNG\r\n\x1a\n", image.read_bytes()[:8]) + + def test_default_layout_includes_head(self): + """Test that pages using the default layout get the shared head.""" + layout = ROOT.joinpath("_layouts", "default.html").read_text() + self.assertRegex(layout, r"{%-?\s*include\s+head\.html\s*-?%}") From 9fa1c5d6ae458d9f5fa8df0ee0cffcd01f02fe28 Mon Sep 17 00:00:00 2001 From: monsterlag <64719697+monsterlag@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:06:45 +0000 Subject: [PATCH 2/2] Add blacksmith logo as site favicon --- tests/test_site.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 tests/test_site.py diff --git a/tests/test_site.py b/tests/test_site.py deleted file mode 100644 index edfd4fb66..000000000 --- a/tests/test_site.py +++ /dev/null @@ -1,42 +0,0 @@ -"""Tests for shared website templates.""" - -import unittest -from html.parser import HTMLParser -from pathlib import Path - -ROOT = Path(__file__).resolve().parent.parent - - -class IconParser(HTMLParser): - """Collect favicon links from HTML.""" - - def __init__(self): - """Initialize the parser.""" - super().__init__() - self.icons = [] - - def handle_starttag(self, tag, attrs): - """Record links whose relation includes icon.""" - attrs = dict(attrs) - if tag == "link" and "icon" in (attrs.get("rel") or "").split(): - self.icons.append(attrs) - - -class TestSite(unittest.TestCase): - """Test the shared website head.""" - - def test_favicon(self): - """Test that the favicon uses the existing blacksmith PNG.""" - parser = IconParser() - parser.feed(ROOT.joinpath("_includes", "head.html").read_text()) - self.assertEqual(1, len(parser.icons), msg="Missing shared favicon link") - icon = parser.icons[0] - self.assertEqual("image/png", icon.get("type")) - self.assertEqual("/images/foundrylogo.png", icon.get("href")) - image = ROOT.joinpath(icon["href"].lstrip("/")) - self.assertEqual(b"\x89PNG\r\n\x1a\n", image.read_bytes()[:8]) - - def test_default_layout_includes_head(self): - """Test that pages using the default layout get the shared head.""" - layout = ROOT.joinpath("_layouts", "default.html").read_text() - self.assertRegex(layout, r"{%-?\s*include\s+head\.html\s*-?%}")