fix(content): slugify transliteration + article links + country overview ranking
- Add @slugify SQLMesh macro (STRIP_ACCENTS + ß→ss) replacing broken inline REGEXP_REPLACE that dropped non-ASCII chars (Düsseldorf → d-sseldorf) - Apply @slugify to dim_venues, dim_cities, dim_locations - Fix Python slugify() to pre-replace ß→ss before NFKD normalization - Add language prefix to B2B article market links (/markets/germany → /de/markets/germany) - Change country overview top-5 ranking: venue count (not raw market_score) for top cities, population for top opportunity cities Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -740,9 +740,14 @@ async def get_all_paddle_prices() -> dict[str, str]:
|
||||
|
||||
|
||||
def slugify(text: str, max_length_chars: int = 80) -> str:
|
||||
"""Convert text to URL-safe slug."""
|
||||
"""Convert text to URL-safe slug.
|
||||
|
||||
Pre-replaces ß→ss before NFKD normalization so output matches the SQL
|
||||
@slugify macro (which uses DuckDB STRIP_ACCENTS + REPLACE).
|
||||
"""
|
||||
text = text.lower().replace("ß", "ss")
|
||||
text = unicodedata.normalize("NFKD", text).encode("ascii", "ignore").decode()
|
||||
text = re.sub(r"[^\w\s-]", "", text.lower())
|
||||
text = re.sub(r"[^\w\s-]", "", text)
|
||||
text = re.sub(r"[-\s]+", "-", text).strip("-")
|
||||
return text[:max_length_chars]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user