Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-11-11 17:51:24

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,144
Website GitHub Mastodon Twitter

Facebook urls

For those of you who receive visitors to your site via facebook or instagram, and despise how your sites’ urls are augmented by their tracking codes, or even worse, your pages are linked by other sites using facebook tracking urls, here is a snippet I experimentally added in the <head> of individual articles that may solve this problem.

<txp:if_individual_article>
<txp:evaluate query='contains("<txp:page_url type="req" />" != "?fbclid="'>
<txp:php>header("Refresh:0; url=<txp:permlink />"); </txp:php>
</txp:evaluate>
</txp:if_individual_article>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2025-03-16 20:14:28

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,646
GitHub Twitter

Re: Facebook urls

…Or maybe this:

<txp:if_individual_article>
<txp:evaluate query='contains("<txp:page_url type="req" />" != "?fbclid="'>
<txp:header name="Status" value="301 Moved Permanently" />
<txp:header name="Location" value='<txp:permlink />' />
</txp:evaluate>
</txp:if_individual_article>

Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#3 2025-03-17 06:32:56

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,144
Website GitHub Mastodon Twitter

Re: Facebook urls

Thanks Patrick,

It is indeed more precise!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB