Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(wiki): add alpha library social card

Kada Liao63f825ca7722
diff --git a/.github/workflows/wiki.yml b/.github/workflows/wiki.yml
index d320b49e1..d85aa4b89 100644
--- a/.github/workflows/wiki.yml
+++ b/.github/workflows/wiki.yml
@@ -38,6 +38,9 @@ jobs:
- name: Check locale JSON
run: python -m json.tool wiki/locales/en.json >/dev/null
+ - name: Check social card metadata
+ run: python wiki/scripts/check_social_cards.py
+
- name: Check static site files
run: |
test -f wiki/index.html
@@ -49,6 +52,7 @@ jobs:
test -f wiki/_redirects
test -f wiki/_headers
test -f wiki/assets/icon.png
+ test -f wiki/assets/alpha-library-og.png
blocked="localhost\\|nano"
blocked="${blocked}bot"
! grep -R "$blocked" wiki --exclude=README.md
diff --git a/wiki/alpha-library/index.html b/wiki/alpha-library/index.html
index 6c69f5147..91002ed47 100644
--- a/wiki/alpha-library/index.html
+++ b/wiki/alpha-library/index.html
@@ -12,8 +12,12 @@
<meta property="og:site_name" content="Vibe-Trading Wiki">
<meta property="og:title" content="Alpha Library">
<meta property="og:description" content="450+ pre-built quant alphas across four zoos. One-line CLI to benchmark any zoo on your universe.">
- <meta property="og:image" content="https://vibetrading.wiki/assets/icon.png">
+ <meta property="og:image" content="https://vibetrading.wiki/assets/alpha-library-og.png">
<meta property="og:url" content="https://vibetrading.wiki/alpha-library/">
+ <meta name="twitter:card" content="summary_large_image">
+ <meta name="twitter:title" content="Alpha Library">
+ <meta name="twitter:description" content="450+ pre-built quant alphas across four zoos. One-line CLI to benchmark any zoo on your universe.">
+ <meta name="twitter:image" content="https://vibetrading.wiki/assets/alpha-library-og.png">
<link rel="canonical" href="https://vibetrading.wiki/alpha-library/">
<link rel="icon" type="image/png" href="/assets/icon.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
diff --git a/wiki/assets/alpha-library-og.png b/wiki/assets/alpha-library-og.png
new file mode 100644
index 000000000..0d5b7f4e4
Binary files /dev/null and b/wiki/assets/alpha-library-og.png differ
diff --git a/wiki/scripts/check_social_cards.py b/wiki/scripts/check_social_cards.py
new file mode 100644
index 000000000..686068ee3
--- /dev/null
+++ b/wiki/scripts/check_social_cards.py
@@ -0,0 +1,61 @@
+"""Validate social-card metadata for static wiki pages."""
+
+from __future__ import annotations
+
+import struct
+from html.parser import HTMLParser
+from pathlib import Path
+
+
+ROOT = Path(__file__).resolve().parents[1]
+
+
+class MetaParser(HTMLParser):
+ """Collect simple head metadata from a static HTML document."""
+
+ def __init__(self) -> None:
+ super().__init__()
+ self.meta: dict[str, str] = {}
+
+ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
+ if tag != "meta":
+ return
+ attr_map = {name: value or "" for name, value in attrs}
+ key = attr_map.get("property") or attr_map.get("name")
+ content = attr_map.get("content")
+ if key and content:
+ self.meta[key] = content
+
+
+def png_size(path: Path) -> tuple[int, int]:
+ with path.open("rb") as handle:
+ header = handle.read(24)
+ if len(header) < 24 or not header.startswith(b"\x89PNG\r\n\x1a\n"):
+ raise AssertionError(f"{path} is not a PNG file")
+ return struct.unpack(">II", header[16:24])
+
+
+def page_meta(relative_path: str) -> dict[str, str]:
+ parser = MetaParser()
+ parser.feed((ROOT / relative_path).read_text(encoding="utf-8"))
+ return parser.meta
+
+
+def require_alpha_library_card() -> None:
+ expected_url = "https://vibetrading.wiki/assets/alpha-library-og.png"
+ expected_asset = ROOT / "assets" / "alpha-library-og.png"
+ meta = page_meta("alpha-library/index.html")
+
+ assert meta.get("og:image") == expected_url, "Alpha Library og:image must use the 1200x630 card"
+ assert meta.get("twitter:card") == "summary_large_image", "Alpha Library must request a large Twitter card"
+ assert meta.get("twitter:image") == expected_url, "Alpha Library twitter:image must match og:image"
+ assert expected_asset.exists(), f"Missing {expected_asset.relative_to(ROOT)}"
+ assert png_size(expected_asset) == (1200, 630), "Alpha Library social card must be 1200x630"
+
+
+def main() -> None:
+ require_alpha_library_card()
+
+
+if __name__ == "__main__":
+ main()