Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDX-10263 - Google Search Console - research why google bot is evalua… #6465

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
{{ data.country_dict.display_name }}
{% endblock %}

{% block links %}
<link rel="alternate" media="{{ h.HDX_CONST('MOBILE_MEDIA') }}" href="{{ h.hdx_switch_url_path(force=False) }}">
{{ super() }}
{% endblock %}

{% block crisis_map %}
{% block crisis_actions %}
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
{% endif %}
</span>
{% endblock %}

{% block links %}
<link rel="alternate" media="{{ h.HDX_CONST('MOBILE_MEDIA') }}" href="{{ h.hdx_switch_url_path(force=False) }}">
{{ super() }}
{% endblock %}

{% block breadcrumb_content %}
{% snippet "snippets/other_breadcrumb_item.html", title=_('Groups'), controller='group', action='index', position=2 %}
<li class="breadcrumb-item active">{{ h.nav_link(data.country_title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
{% asset 'hdx_theme/organizations-styles' %}
{% endblock %}

{% block links %}
<link rel="canonical" href="{{ h.hdx_switch_url_path(force=False) }}">
{{ super() }}
{% endblock %}

{% set logged_in = true if c.userobj else false %}
{% set is_sys_admin = c.userobj.sysadmin %}
{% block subtitle %}{{ _('Organisations') }}{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{% asset 'hdx_theme/organization-light-styles' %}
{% endblock -%}

{% block subtitle %}{{ org.title }}{% endblock %}

{% block links %}
<link rel="canonical" href="{{ h.hdx_switch_url_path(force=False) }}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{% asset 'hdx_theme/search-light-styles' %}
{% endblock -%}

{% block subtitle %}{{ _("Search for a Dataset") }}{% endblock %}

{% block links %}
<link rel="canonical" href="{{ h.hdx_switch_url_path(force=False) }}">
{{ super() }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{% extends "page.html" %}
{% set page_has_mobile_version = True %}

{% block links %}
<link rel="alternate" media="{{ h.HDX_CONST('MOBILE_MEDIA') }}" href="{{ h.hdx_switch_url_path(force=False) }}">
{{ super() }}
{% endblock %}

{% block styles %}
{{ super() }}
{% asset 'hdx_theme/custom-org-search-facets-styles' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
{% set is_sys_admin = c.userobj.sysadmin %}
{% block subtitle %}{{ _('Organisations') }}{% endblock %}

{% block links %}
<link rel="alternate" media="{{ h.HDX_CONST('MOBILE_MEDIA') }}" href="{{ h.hdx_switch_url_path(force=False) }}">
{{ super() }}
{% endblock %}

{% block breadcrumb_content %}
<li class="breadcrumb-item active">{% link_for _('Organisations'), controller='organization', action='index' %}</li>
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
{% endblock %}

{% block links %}
<link rel="alternate" media="{{ h.HDX_CONST('MOBILE_MEDIA') }}" href="{{ h.hdx_switch_url_path(force=False) }}">
{{ super() }}
{% if 'country_dict' in org_dict %}
{% set group_dict = org_dict %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

{% block subtitle %}{{ data.title or data.name }}{% endblock %}

{% block links %}
<link rel="alternate" media="{{ h.HDX_CONST('MOBILE_MEDIA') }}" href="{{ h.hdx_switch_url_path(force=False) }}">
{{ super() }}
{% endblock %}

{% block breadcrumb_content %}
<li class="breadcrumb-item"><a>{{ data.type }}</a></li>
{% if data.type == 'event' %}
Expand Down
19 changes: 19 additions & 0 deletions ckanext-hdx_theme/ckanext/hdx_theme/util/light_redirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,24 @@ def switch_url_path(path=None, force=True):
new_path = urlparse.urlunparse(
parsed_url[0:4] + (query + force_query,) + parsed_url[5:]
)
else:
parsed_url = urlparse.urlparse(new_path)
query_params = urlparse.parse_qs(parsed_url.query, True)

if FORCE_REDIRECT_URL_PARAM in query_params:
del query_params[FORCE_REDIRECT_URL_PARAM]

# Reconstruct the URL
new_query = urlparse.urlencode(query_params, doseq=True)
new_url = urlparse.urlunparse((
parsed_url.scheme,
parsed_url.netloc,
parsed_url.path,
parsed_url.params,
new_query,
parsed_url.fragment
))

new_path = new_url

return new_path
Loading