• Hi there,

    I don’t think this is possible but I just wanted to check.

    Is it possible to change which URL is canonicalised depending on the value of a query string?

    For example, we have a search page:
    /property-search/

    When you search, complex querstrings may be generated which canonicalise back to /property-search/ e.g.
    /property-search/?orderby=price_desc&instruction_type=sale&place=Bar+Hill%2C+Cambridge%2C+UK&bounds=%7B”south”%3A52.245372275973914%2C”west”%3A0.008389726855343296%2C”north”%3A52.25967467036036%2C”east”%3A0.03699444171009975%7D&radius=3&showstc=on

    However depending on the content in the string, very different content can be loaded on the page. I would like to make it so that rather than canonicalising everything to /search/ some URLs can have a different canonical depending on what is in the query string.

    e.g. this:
    /property-search/?orderby=price_desc&instruction_type=sale&place=Bar+Hill%2C+Cambridge%2C+UK&bounds=%7B”south”%3A52.245372275973914%2C”west”%3A0.008389726855343296%2C”north”%3A52.25967467036036%2C”east”%3A0.03699444171009975%7D&radius=3&showstc=on

    Would canonicalise to this:
    /property-search/?place=Bar+Hill

    Rather than to just /search/

    Is there any way to do this?

    • This topic was modified 4 days, 17 hours ago by stuseo. Reason: Clarity

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @stuseo

    Thanks for reaching out. Yes, it is definitely possible, but there’s no feature in the plugin’s settings UI to do so. It requires custom code by using the wpseo_canonical filter to the property-search page to retain the ‘place’ parameter. If you’re unfamiliar with using code snippets, we’d like to refer you to the WordPress documentation on how to use a filter.

    Thread Starter stuseo

    (@stuseo)

    Fantastic, thanks Maybellyne – I’ll have a chat with the developers. Great to know it’s possible!

    I’ll report back if we manage it.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.