Skip to content

Commit 2a48ed2

Browse files
committed
fixed the favicon and image on top left fix on all 4 sites
1 parent 6c00a60 commit 2a48ed2

14 files changed

Lines changed: 43 additions & 13 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,12 @@ jobs:
157157
lang = rel.split(os.sep, 1)[0]
158158
prefix = f"{base_path}/{lang}" if base_path else f"/{lang}"
159159
160-
favicon_path = f"{prefix}/assets/images/favicon.png"
161-
favicon_ico_path = f"{prefix}/assets/images/favicon.ico"
160+
favicon_path = f"{prefix}/assets/images/favicon-76x76.png"
162161
163162
# Replace favicon link tags
164163
content = re.sub(
165164
r'<link[^>]*rel=["\'](?:shortcut )?icon["\'][^>]*>',
166-
f'<link rel="icon" href="{favicon_ico_path}">\n <link rel="icon" type="image/png" href="{favicon_path}">',
165+
f'<link rel="icon" href="{favicon_path}" type="image/png">',
167166
content,
168167
flags=re.IGNORECASE
169168
)
@@ -173,7 +172,7 @@ jobs:
173172
# Insert before </head>
174173
content = re.sub(
175174
r'(</head>)',
176-
f' <link rel="icon" href="{favicon_ico_path}">\n <link rel="icon" type="image/png" href="{favicon_path}">\n\\1',
175+
f' <link rel="icon" href="{favicon_path}" type="image/png">\n\\1',
177176
content,
178177
flags=re.IGNORECASE
179178
)
@@ -200,6 +199,7 @@ jobs:
200199
<meta charset="utf-8" />
201200
<meta name="viewport" content="width=device-width, initial-scale=1" />
202201
<meta http-equiv="refresh" content="0; url=./en/" />
202+
<link rel="icon" href="./en/assets/images/favicon-76x76.png" type="image/png" />
203203
<link rel="canonical" href="./en/" />
204204
<title>omegaUp Documentation</title>
205205
<script>

build_all.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def main():
8787
<meta charset="utf-8" />
8888
<meta name="viewport" content="width=device-width, initial-scale=1" />
8989
<meta http-equiv="refresh" content="0; url=./en/" />
90+
<link rel="icon" href="./en/assets/images/favicon-76x76.png" type="image/png" />
9091
<link rel="canonical" href="./en/" />
9192
<title>omegaUp Documentation</title>
9293
<script>
1.15 KB
Loading
1.15 KB
Loading

docs/es/stylesheets/omegaup-theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
}
7676

7777
/* Fix logo rendering on homepage - prevent cropping */
78-
.md-typeset img[alt*="omegaUp Logo"],
78+
.md-typeset img[alt*="Logotipo"],
7979
.md-typeset img[src*="omegaup.svg"],
8080
.md-typeset img[src*="omegaup.png"] {
8181
max-width: 100%;
1.15 KB
Loading

docs/pt-BR/stylesheets/omegaup-theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
}
7676

7777
/* Fix logo rendering on homepage - prevent cropping */
78-
.md-typeset img[alt*="omegaUp Logo"],
78+
.md-typeset img[alt*="Logotipo"],
7979
.md-typeset img[src*="omegaup.svg"],
8080
.md-typeset img[src*="omegaup.png"] {
8181
max-width: 100%;
1.15 KB
Loading

docs/pt/stylesheets/omegaup-theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
}
7676

7777
/* Fix logo rendering on homepage - prevent cropping */
78-
.md-typeset img[alt*="omegaUp Logo"],
78+
.md-typeset img[alt*="Logotipo"],
7979
.md-typeset img[src*="omegaup.svg"],
8080
.md-typeset img[src*="omegaup.png"] {
8181
max-width: 100%;

serve_multilang.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
import http.server
10+
import re
1011
import socketserver
1112
import os
1213
import sys
@@ -16,11 +17,39 @@
1617
ROOT = Path(__file__).parent
1718
SITE_DIR = ROOT / "site"
1819

20+
21+
def _warn_if_favicon_href_mismatch():
22+
"""Partial single-language rebuilds leave other site/<lang>/ trees stale (wrong favicon, assets)."""
23+
hrefs = {}
24+
for lang in ("en", "es", "pt", "pt-BR"):
25+
idx = SITE_DIR / lang / "index.html"
26+
if not idx.is_file():
27+
continue
28+
text = idx.read_text(encoding="utf-8", errors="replace")
29+
for tag in re.finditer(r"<link\b[^>]*>", text, re.IGNORECASE):
30+
t = tag.group(0)
31+
if not re.search(r'rel\s*=\s*["\']icon["\']', t, re.IGNORECASE):
32+
continue
33+
hm = re.search(r'href\s*=\s*(["\'])([^"\']+)\1', t, re.IGNORECASE)
34+
if hm:
35+
hrefs[lang] = hm.group(2)
36+
break
37+
unique = set(hrefs.values())
38+
if len(unique) > 1:
39+
print(
40+
"Warning: <link rel=\"icon\"> href differs between languages (stale site/ output).\n"
41+
" Run: python3 build_all.py\n"
42+
f" Seen: {hrefs}"
43+
)
44+
45+
1946
if not SITE_DIR.exists():
2047
print(f"Error: {SITE_DIR} does not exist.")
2148
print("Please build the site first using: zensical build")
2249
sys.exit(1)
2350

51+
_warn_if_favicon_href_mismatch()
52+
2453
os.chdir(SITE_DIR)
2554

2655
PORT = 8000

0 commit comments

Comments
 (0)