From bdd9ac8d4f8460b47dd40445483e73c364beecd5 Mon Sep 17 00:00:00 2001 From: Andy Chosak Date: Tue, 23 Jun 2026 12:33:58 -0400 Subject: [PATCH] Fix: Make LIVE links consistently point to www This project overrides the Wagtail page status tag template to always use the "full" page URL: https://github.com/cfpb/consumerfinance.gov/blob/c6703651d2abffcba4fbec3e95ea8aa187acdc07/cfgov/wagtailadmin_overrides/templates/wagtailadmin/shared/page_status_tag.html This is to enforce LIVE links to www.cf.gov even when browsing Wagtail on an alternate domain name. This functionality was working only partially; some LIVE links weren't pointing to www as desired. This change adds an additional template override to accomplish this. The content of this file comes from https://github.com/wagtail/wagtail/blob/cb3ed5a2891466f99aa213575caf40ef273a307b/wagtail/admin/templates/wagtailadmin/shared/page_status_tag_new.html with page.url replaced by page.full_url, to be consistent with the existing override. See internal cfgov#4679 for context. --- .../shared/page_status_tag_new.html | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 cfgov/wagtailadmin_overrides/templates/wagtailadmin/shared/page_status_tag_new.html diff --git a/cfgov/wagtailadmin_overrides/templates/wagtailadmin/shared/page_status_tag_new.html b/cfgov/wagtailadmin_overrides/templates/wagtailadmin/shared/page_status_tag_new.html new file mode 100644 index 00000000000..aa870abda97 --- /dev/null +++ b/cfgov/wagtailadmin_overrides/templates/wagtailadmin/shared/page_status_tag_new.html @@ -0,0 +1,47 @@ +{% load i18n wagtailadmin_tags %} +{% comment %} + + Variables accepted by this template: + + - `page` - A wagtail page object + - `classes` - String of extra css classes to pass to this component +{% endcomment %} + +{% comment %} Unable to use pageurl template tag here due to issues in unit tests where request is not yet available - see #10157 {% endcomment %} +{% if page.live and page.full_url is not None %} + {% test_page_is_public page as is_public %} + {% trans 'Live' as live_label %} + {% comment %} Two copies of the tag, visibility is toggled by the privacy switch JS {% endcomment %} + + {% icon classname='w-w-4 w-h-4 w-mr-1' name="view" %} + {{ live_label }} + + + {% icon classname='w-w-4 w-h-4 w-mr-1' name="no-view" %} + {{ live_label }} + +{% endif %}