Opened 9 months ago

Last modified 4 months ago

#5530 new change

Allow canonical link override in page front-matter

Reported by: juliandoucette Assignee:
Priority: P3 Milestone:
Module: Sitescripts Keywords:
Cc: kvas, jsonesen, wspee, ire, greiner, saroyanm, lisabielik Blocked By:
Blocking: #5531 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by kvas)

Background

  • get_canonical_url was implemented in #5343
  • this solution was not ideal for adblockplus.org because adblockplus.org contains one home page per browser that is served/redirected based on UA sniffing e.g. "index" -> "chrome", "index" -> "firefox" based on chrome/firefox UA

What to change

Allow the canonical url (specifically, the page that is used to derive the canonical url) to be overridden in page front-matter e.g.

example.md

<!--
title=Example
canonical_page=another_page
-->

In this example get_canonical_url('example') would return https://foo.bar/another_page instead of https://foo.bar/example.

Note: if another_page also overrides canonical_page, get_canonical_url() should follow that as well, until we get to a page that doesn't want to override it.

Change History (6)

comment:1 Changed 9 months ago by juliandoucette

  • Blocking 5531 added

comment:2 follow-up: Changed 9 months ago by kvas

canonical=index

This variable name is not very specific. What do you think about canonical_page=index (that would ask get_canonical_url to calculate canonical url for that page instead) or canonical_url=/ (that would force the canonical url to a certain value, that would be prefixed with site_url unless it's a full url) or perhaps supporting both of these options?

comment:3 in reply to: ↑ 2 Changed 9 months ago by juliandoucette

Replying to kvas:

canonical=index

This variable name is not very specific. What do you think about canonical_page=index (that would ask get_canonical_url to calculate canonical url for that page instead) or canonical_url=/ (that would force the canonical url to a certain value, that would be prefixed with site_url unless it's a full url) or perhaps supporting both of these options?

Both are fine with me. And/But canonical_page would be ideal for abp.org currently.

Last edited 9 months ago by juliandoucette (previous) (diff)

comment:4 Changed 9 months ago by kvas

  • Description modified (diff)
  • Priority changed from Unknown to P3
  • Ready set

Ok, I guess let's implement just canonical_page for now. Adding canonical_url later would be easy if we need it.

comment:5 Changed 4 months ago by asmirnov

  • Blocking 6260 added

comment:6 Changed 4 months ago by asmirnov

  • Blocking 6260 removed
Note: See TracTickets for help on using tickets.