Skip to content

Commit e21aa76

Browse files
committed
feat: automate OpenGraph meta tag syncing and update share card styling and layout
1 parent 86fc213 commit e21aa76

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

scripts/update_metrics.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,31 @@ def run(self) -> None:
498498
logger.critical("Failed writing output file '%s': %s", self.config.output_json, exc)
499499
raise TelemetryError(f"Could not write destination file: {self.config.output_json}") from exc
500500

501+
self._sync_index_html_meta(self.config.target)
502+
503+
def _sync_index_html_meta(self, target: str) -> None:
504+
"""Keep static OpenGraph meta tags in index.html in sync with the detected target user."""
505+
index_html_path = Path(__file__).resolve().parent.parent / "index.html"
506+
if not index_html_path.is_file():
507+
return
508+
try:
509+
content = index_html_path.read_text(encoding="utf-8")
510+
import re
511+
content = re.sub(
512+
r'<meta property="og:title" content="[^"]*" id="og-title" />',
513+
f'<meta property="og:title" content="Estadísticas de @{target} en GitHub 📊 ¡Crea tu dashboard gratis!" id="og-title" />',
514+
content
515+
)
516+
content = re.sub(
517+
r'<meta name="twitter:title" content="[^"]*" id="twitter-title" />',
518+
f'<meta name="twitter:title" content="Estadísticas de @{target} en GitHub 📊 ¡Crea tu dashboard gratis!" id="twitter-title" />',
519+
content
520+
)
521+
index_html_path.write_text(content, encoding="utf-8")
522+
logger.info("✔ Synced OpenGraph meta tags in index.html for target '@%s'", target)
523+
except OSError as exc:
524+
logger.warning("Could not sync index.html meta tags: %s", exc)
525+
501526

502527
def main() -> None:
503528
"""CLI entrypoint with graceful exit codes."""

templates/share.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,19 @@
9292
<div class="flex items-start justify-between border-b border-zinc-200 pb-4 pt-1">
9393
<div class="flex items-center gap-4">
9494
<!-- Avatar a la izquierda -->
95-
<img id="cardAvatar" src="https://github.com/shellaquiles.png?size=128" alt="Avatar" class="w-14 h-14 rounded-full border border-zinc-300 bg-zinc-100 object-cover" />
95+
<img id="cardAvatar" src="https://github.com/shellaquiles.png?size=128" alt="Avatar" class="w-14 h-14 rounded-full border border-zinc-300 bg-zinc-100 object-cover shrink-0" />
9696

9797
<div class="space-y-0.5">
9898
<div class="flex items-center gap-3">
99-
<span class="font-mono text-2xl font-bold tracking-tight">
100-
<span style="color:#71717a;font-weight:400;">{{</span><span style="color:#22c55e;font-weight:700;">shell</span><span style="color:#09090b;font-weight:700;">aquiles</span><span style="color:#f43f5e;font-weight:700;">.org</span><span style="color:#71717a;font-weight:400;">}}</span>
101-
</span>
99+
<span class="font-mono text-2xl font-black tracking-tight text-zinc-950" id="cardUserHandle">@shellaquiles</span>
102100
<span class="px-2 py-0.5 bg-zinc-100 text-zinc-800 font-mono text-xs font-bold border border-zinc-300" id="cardVersion">v1.0.0</span>
103101
</div>
104102
<div class="font-mono text-xs text-zinc-500 flex items-center gap-2 pt-0.5">
105103
<span>HUELLA DIGITAL & PROYECTOS OPEN SOURCE</span>
106104
<span class="text-zinc-300"></span>
107-
<span id="cardUserHandle" class="text-zinc-900 font-bold">@shellaquiles</span>
105+
<span class="text-zinc-700 font-bold">
106+
by <span style="color:#71717a;font-weight:400;">{{</span><span style="color:#22c55e;font-weight:700;">shell</span><span style="color:#09090b;font-weight:700;">aquiles</span><span style="color:#f43f5e;font-weight:700;">.org</span><span style="color:#71717a;font-weight:400;">}}</span>
107+
</span>
108108
</div>
109109
</div>
110110
</div>

0 commit comments

Comments
 (0)