From b0901b7dc797d13aeb298748788fbc2804ca9873 Mon Sep 17 00:00:00 2001 From: PeninsulaInd Date: Mon, 3 Nov 2025 08:20:59 -0600 Subject: [PATCH] Fixed- Adds the cannoical for real now - version 1.1.4 --- src/generation/batch_processor.py | 4 +++- src/templating/service.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/generation/batch_processor.py b/src/generation/batch_processor.py index 816c4f5..7690eac 100644 --- a/src/generation/batch_processor.py +++ b/src/generation/batch_processor.py @@ -681,10 +681,12 @@ class BatchProcessor: # Step 4: Apply templates click.echo(f" Applying templates...") + url_map = {url_info["content_id"]: url_info["url"] for url_info in article_urls} template_count = 0 for content in content_records: 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 except Exception as e: click.echo(f" Warning: Failed to apply template to content {content.id}: {e}") diff --git a/src/templating/service.py b/src/templating/service.py index 822f869..d870b3d 100644 --- a/src/templating/service.py +++ b/src/templating/service.py @@ -139,8 +139,8 @@ class TemplateService: formatted_html = formatted_html.replace("{{ meta_description }}", self._escape_html(meta_description)) formatted_html = formatted_html.replace("{{ content }}", content) - if canonical_url: - formatted_html = formatted_html.replace("{{ canonical_url }}", canonical_url) + canonical_url_value = canonical_url if canonical_url else "" + formatted_html = formatted_html.replace("{{ canonical_url }}", canonical_url_value) return formatted_html