fix: remove double language prefix from article URLs
generate_articles() was storing url_path with lang prefix (/en/markets/...) but the content blueprint is registered at /<lang>, producing double-prefix URLs like /en/en/markets/italy. Fix: store url_path without prefix, build full_url with prefix for SEO tags (canonical, OG, hreflang, breadcrumbs). Also removes /markets from RESERVED_PREFIXES since article sub-paths under /markets/ are valid pSEO content URLs, not blueprint routes. Subtask 1 of pSEO template improvements. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -322,8 +322,9 @@ class TestReservedPaths:
|
||||
def test_planner_reserved(self):
|
||||
assert is_reserved_path("/planner/") is True
|
||||
|
||||
def test_markets_reserved(self):
|
||||
assert is_reserved_path("/markets") is True
|
||||
def test_markets_not_reserved(self):
|
||||
# /markets sub-paths are article URLs; explicit /markets route takes priority
|
||||
assert is_reserved_path("/markets/germany/berlin") is False
|
||||
|
||||
def test_custom_path_allowed(self):
|
||||
assert is_reserved_path("/padel-court-cost-miami") is False
|
||||
@@ -456,7 +457,7 @@ class TestGenerationPipeline:
|
||||
|
||||
miami = await fetch_one("SELECT * FROM articles WHERE slug = 'test-city-en-miami'")
|
||||
assert miami is not None
|
||||
assert miami["url_path"] == "/en/markets/us/miami"
|
||||
assert miami["url_path"] == "/markets/us/miami"
|
||||
assert miami["title"] == "Padel in Miami"
|
||||
assert miami["template_slug"] == "test-city"
|
||||
assert miami["language"] == "en"
|
||||
@@ -761,7 +762,7 @@ class TestPreviewArticle:
|
||||
from padelnomics.content import preview_article
|
||||
result = await preview_article("test-city", "miami")
|
||||
assert result["title"] == "Padel in Miami"
|
||||
assert result["url_path"] == "/en/markets/us/miami"
|
||||
assert result["url_path"] == "/markets/us/miami"
|
||||
assert result["meta_description"] == "Padel costs in Miami"
|
||||
assert "<h1>" in result["html"]
|
||||
|
||||
@@ -773,7 +774,7 @@ class TestPreviewArticle:
|
||||
async def test_preview_with_language(self, db, pseo_env):
|
||||
from padelnomics.content import preview_article
|
||||
result = await preview_article("test-city", "miami", lang="de")
|
||||
assert result["url_path"] == "/de/markets/us/miami"
|
||||
assert result["url_path"] == "/markets/us/miami"
|
||||
|
||||
async def test_preview_unknown_template_raises(self, db, pseo_env):
|
||||
from padelnomics.content import preview_article
|
||||
|
||||
Reference in New Issue
Block a user