Skip to content

Commit

Permalink
Merge pull request #8261 from cfpb/actual-canonical-links
Browse files Browse the repository at this point in the history
Remove querystring from generated canonical links
  • Loading branch information
wpears authored Mar 21, 2024
2 parents 5652238 + c01bf9d commit f76e671
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def test_search_page_renders_with_facet_parameters(self, mock_search):
f"{self.search_page.url}?topic=1&topic=2&topic=3"
)
self.assertEqual(response.status_code, 200)
self.assertIn("topic=1", response.content.decode("utf8"))

def test_taxonomy_model_str(self):
taxonomy_instance = ActivityBuildingBlock.objects.first()
Expand Down
6 changes: 4 additions & 2 deletions cfgov/v1/jinja2/v1/layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@
<base target="_blank">
{% endif %}

<link rel="canonical" href="{{ request.build_absolute_uri() | lower }}">
{% set canonical = request.build_absolute_uri(request.path) | lower %}

<link rel="canonical" href="{{ canonical }}">

{# Open Graph properties #}

{# Required Open Graph properties #}
<meta property="og:title" content="{% block og_title %}{{ self.title() }}{% endblock %}">
<meta property="og:type" content="{% block og_type %}website{% endblock %}">
<meta property="og:url" content="{{ request.build_absolute_uri() | lower }}">
<meta property="og:url" content="{{ canonical }}">

{% block og_image %}
{% if page and page.meta_image %}
Expand Down

0 comments on commit f76e671

Please sign in to comment.