Fixed- Adds the cannoical for real now - version 1.1.4

main
PeninsulaInd 2025-11-03 08:20:59 -06:00
parent 14df158a7a
commit b0901b7dc7
2 changed files with 5 additions and 3 deletions

View File

@ -681,10 +681,12 @@ class BatchProcessor:
# Step 4: Apply templates # Step 4: Apply templates
click.echo(f" Applying templates...") click.echo(f" Applying templates...")
url_map = {url_info["content_id"]: url_info["url"] for url_info in article_urls}
template_count = 0 template_count = 0
for content in content_records: for content in content_records:
try: try:
if self.generator.apply_template(content.id): canonical_url = url_map.get(content.id)
if self.generator.apply_template(content.id, canonical_url=canonical_url):
template_count += 1 template_count += 1
except Exception as e: except Exception as e:
click.echo(f" Warning: Failed to apply template to content {content.id}: {e}") click.echo(f" Warning: Failed to apply template to content {content.id}: {e}")

View File

@ -139,8 +139,8 @@ class TemplateService:
formatted_html = formatted_html.replace("{{ meta_description }}", self._escape_html(meta_description)) formatted_html = formatted_html.replace("{{ meta_description }}", self._escape_html(meta_description))
formatted_html = formatted_html.replace("{{ content }}", content) formatted_html = formatted_html.replace("{{ content }}", content)
if canonical_url: canonical_url_value = canonical_url if canonical_url else ""
formatted_html = formatted_html.replace("{{ canonical_url }}", canonical_url) formatted_html = formatted_html.replace("{{ canonical_url }}", canonical_url_value)
return formatted_html return formatted_html