Fix canonical urls a bit.

This commit is contained in:
flash 2018-07-07 22:11:16 +02:00
parent f2a5c3db01
commit fa368c396c
4 changed files with 26 additions and 7 deletions

View file

@ -3,7 +3,10 @@
{% from '@mio/forum/macros.twig' import forum_category_listing, forum_topic_listing, forum_category_buttons %}
{% set title = forum_info.forum_name %}
{% set canonical_url = '/forum/forum.php?f=' ~ forum_info.forum_id %}
{% set canonical_url = '/forum/forum.php'|url_construct({
'f': forum_info.forum_id,
'o': forum_offset,
}) %}
{% block content %}
{{ navigation(forum_breadcrumbs, forum_breadcrumbs|last, true, null, 'left') }}
@ -14,7 +17,12 @@
{% if forum_info.forum_type == 0 %}
{% set fcbuttons = app.hasActiveSession ? forum_category_buttons(forum_info) : '' %}
{% set fcpagination = pagination(forum_info.forum_topic_count, forum_range, forum_offset, canonical_url, 'forum__') %}
{% set fcpagination = pagination(
forum_info.forum_topic_count,
forum_range,
forum_offset,
'/forum/forum.php'|url_construct({'f': forum_info.forum_id}), 'forum__'
) %}
{{ fcbuttons }}
{{ fcpagination }}

View file

@ -10,12 +10,20 @@
%}
{% set title = topic_info.topic_title %}
{% set base_url = '/forum/topic.php?t=' ~ topic_info.topic_id %}
{% set canonical_url = base_url %}
{% set canonical_url = '/forum/topic.php'|url_construct({
't': topic_info.topic_id,
'o': topic_offset,
}) %}
{% set can_reply = app.hasActiveSession and topic_info.topic_locked is null and not topic_info.topic_archived %}
{% set ftbuttons = can_reply ? forum_topic_buttons(topic_info) : '' %}
{% set ftpagination = pagination(topic_info.topic_post_count, topic_range, topic_offset, base_url, 'forum__') %}
{% set ftpagination = pagination(
topic_info.topic_post_count,
topic_range,
topic_offset,
'/forum/topic.php'|url_construct({'t': topic_info.topic_id}),
'forum__'
) %}
{% block content %}
{{ navigation(topic_breadcrumbs, topic_breadcrumbs|last, true, null, 'left') }}

View file

@ -3,7 +3,10 @@
{% from '@mio/news/macros.twig' import news_preview %}
{% set title = category.category_name ~ ' :: News' %}
{% set canonical_url = '/news.php?c=' ~ category.category_id ~ (posts_offset > 0 ? '&o=' ~ posts_offset : '') %}
{% set canonical_url = '/news.php'|url_construct({
'c': category.category_id,
'o': posts_offset,
}) %}
{% block news_content %}
<div class="container news__container">

View file

@ -3,7 +3,7 @@
{% from '@mio/news/macros.twig' import news_preview %}
{% set title = 'News' %}
{% set canonical_url = '/news.php' ~ (posts_offset > 0 ? '?o=' ~ posts_offset : '') %}
{% set canonical_url = '/news.php'|url_construct({'o':posts_offset}) %}
{% block news_content %}
<div class="container news__container">