<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
 <generator>http://textpattern.com/</generator>
 <title>Textpattern Tips – Dynamic canonical URLs</title>
 <description>Dynamic canonical URLs - comments</description>
 <link>https://textpattern.tips/dynamic-canonical-urls</link>
 <atom:link href="https://textpattern.tips/dynamic-canonical-urls?f=comment-feed" rel="self" type="application/rss+xml" />
 <pubDate>Fri, 02 Dec 11 13:33:27 +0000</pubDate>

 <item>
     <title>Comment on Dynamic canonical URLs by MattD</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c000497" id="c000497">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c000497" id="c000497">1</a></guid>
     <pubDate>Thu, 25 Jun 09 21:07:46 +0000</pubDate>
     <description><![CDATA[<p>I&#8217;ve implemented this but made a minor tweak for the default section.</p><pre><code>&lt;txp:if_individual_article&gt;
   &lt;link rel="canonical" href="&lt;txp:permlink /&gt;" /&gt;
&lt;txp:else /&gt;
&lt;txp:if_section name=""&gt;
   &lt;link rel="canonical" href="&lt;txp:site_url /&gt;" /&gt;
&lt;txp:else/&gt;
&lt;link rel="canonical" href="&lt;txp:site_url /&gt;&lt;txp:section /&gt;" /&gt;
&lt;/txp:if_section&gt;
&lt;/txp:if_individual_article&gt;
</code></pre>]]></description>
     <content:encoded><![CDATA[<p>I&#8217;ve implemented this but made a minor tweak for the default section.</p><pre><code>&lt;txp:if_individual_article&gt;
   &lt;link rel="canonical" href="&lt;txp:permlink /&gt;" /&gt;
&lt;txp:else /&gt;
&lt;txp:if_section name=""&gt;
   &lt;link rel="canonical" href="&lt;txp:site_url /&gt;" /&gt;
&lt;txp:else/&gt;
&lt;link rel="canonical" href="&lt;txp:site_url /&gt;&lt;txp:section /&gt;" /&gt;
&lt;/txp:if_section&gt;
&lt;/txp:if_individual_article&gt;
</code></pre>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://photographdaddy.com">MattD</a></dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Nora Brown</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c000498" id="c000498">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c000498" id="c000498">1</a></guid>
     <pubDate>Fri, 26 Jun 09 14:03:51 +0000</pubDate>
     <description><![CDATA[<p>This is really helpful&#8230;I wasn&#8217;t even aware of canonical urls. Thanks for the tip.</p>]]></description>
     <content:encoded><![CDATA[<p>This is really helpful&#8230;I wasn&#8217;t even aware of canonical urls. Thanks for the tip.</p>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://www,norabrowndesign.com">Nora Brown</a></dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Patrick</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c000503" id="c000503">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c000503" id="c000503">1</a></guid>
     <pubDate>Thu, 02 Jul 09 12:24:38 +0000</pubDate>
     <description><![CDATA[<p>Very helpfull. Tks Kevin and Matt</p>]]></description>
     <content:encoded><![CDATA[<p>Very helpfull. Tks Kevin and Matt</p>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="https://cara-tm.com">Patrick</a></dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Dan Andrew Brendstrup</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c000698" id="c000698">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c000698" id="c000698">1</a></guid>
     <pubDate>Sun, 18 Apr 10 13:00:06 +0000</pubDate>
     <description><![CDATA[<p>I&#8217;ve used a variation of this technique which avoids the conditional tags at the cost of a dash of php:</p><pre><code>&lt;txp:php&gt;echo rtrim(site_url(array()), '/');&lt;/txp:php&gt;&lt;txp:page_url /&gt;
</code></pre><p>If the site_url or page_url tag offered an attribute to strip the trailing/beginning slash we could do with a simple <code>&lt;txp:site_url /&gt;&lt;txp:page_url /&gt;</code>, but that gives a double-slash after the domain name, so the rtrim is necessary.</p><p>Still, it&#8217;s a bit easier than the nested tags, and it works for both the front page, section pages and permalinks.</p>]]></description>
     <content:encoded><![CDATA[<p>I&#8217;ve used a variation of this technique which avoids the conditional tags at the cost of a dash of php:</p><pre><code>&lt;txp:php&gt;echo rtrim(site_url(array()), '/');&lt;/txp:php&gt;&lt;txp:page_url /&gt;
</code></pre><p>If the site_url or page_url tag offered an attribute to strip the trailing/beginning slash we could do with a simple <code>&lt;txp:site_url /&gt;&lt;txp:page_url /&gt;</code>, but that gives a double-slash after the domain name, so the rtrim is necessary.</p><p>Still, it&#8217;s a bit easier than the nested tags, and it works for both the front page, section pages and permalinks.</p>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://www.twitter.com/bewildergeist">Dan Andrew Brendstrup</a></dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Mischa van der Spek</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c000790" id="c000790">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c000790" id="c000790">1</a></guid>
     <pubDate>Wed, 08 Sep 10 12:50:45 +0000</pubDate>
     <description><![CDATA[<p>This is really useful for building a proper <span class="caps">SEO</span>/SERP website. Thank you for taking the time to write this awesome post!</p>]]></description>
     <content:encoded><![CDATA[<p>This is really useful for building a proper <span class="caps">SEO</span>/SERP website. Thank you for taking the time to write this awesome post!</p>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://www.mischavanderspek.com">Mischa van der Spek</a></dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Mischa van der Spek</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c000791" id="c000791">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c000791" id="c000791">1</a></guid>
     <pubDate>Wed, 08 Sep 10 13:08:17 +0000</pubDate>
     <description><![CDATA[<p>Question: How do I get rid of /default? On my home page is now has http://www.mischavanderspek.com/default as canonical which isn&#8217;t very nice.</p><p>Thank you,<br>Mischa</p>]]></description>
     <content:encoded><![CDATA[<p>Question: How do I get rid of /default? On my home page is now has http://www.mischavanderspek.com/default as canonical which isn&#8217;t very nice.</p><p>Thank you,<br>Mischa</p>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://www.mischavanderspek.com">Mischa van der Spek</a></dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Jonathan Stubbs</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c000792" id="c000792">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c000792" id="c000792">1</a></guid>
     <pubDate>Thu, 09 Sep 10 04:51:47 +0000</pubDate>
     <description><![CDATA[<p>Mischa, have you looked at MattD&#8217;s comment above? He has this line of code which should do what you want:</p><pre><code>&lt;txp:if_section name=""&gt;
   &lt;link rel="canonical" href="&lt;txp:site_url /&gt;" /&gt;
</code></pre>]]></description>
     <content:encoded><![CDATA[<p>Mischa, have you looked at MattD&#8217;s comment above? He has this line of code which should do what you want:</p><pre><code>&lt;txp:if_section name=""&gt;
   &lt;link rel="canonical" href="&lt;txp:site_url /&gt;" /&gt;
</code></pre>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://jonathanstubbs.com">Jonathan Stubbs</a></dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Will Atkinson</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c001009" id="c001009">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c001009" id="c001009">1</a></guid>
     <pubDate>Tue, 25 Oct 11 06:58:10 +0000</pubDate>
     <description><![CDATA[<p>Like Jonathan, I am unsure how to implement canonicals using php on a site that includes only one header (which is shared through sessions), by each page of the site.</p>]]></description>
     <content:encoded><![CDATA[<p>Like Jonathan, I am unsure how to implement canonicals using php on a site that includes only one header (which is shared through sessions), by each page of the site.</p>]]></content:encoded>
     <dc:creator>Will Atkinson</dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Phil</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c001026" id="c001026">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c001026" id="c001026">1</a></guid>
     <pubDate>Fri, 02 Dec 11 13:30:50 +0000</pubDate>
     <description><![CDATA[<p>I wish txp:site_url didn&#8217;t automatically create a trailing slash as it stops its use with txp:page_url to create a full url to the page for use in things like Twitter buttons.</p>]]></description>
     <content:encoded><![CDATA[<p>I wish txp:site_url didn&#8217;t automatically create a trailing slash as it stops its use with txp:page_url to create a full url to the page for use in things like Twitter buttons.</p>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://www.caravanwise.co.uk/">Phil</a></dc:creator>
 
</item>
<item>
     <title>Comment on Dynamic canonical URLs by Phil</title>
     <link><a href="https://textpattern.tips/dynamic-canonical-urls#c001027" id="c001027">1</a></link>
     <guid><a href="https://textpattern.tips/dynamic-canonical-urls#c001027" id="c001027">1</a></guid>
     <pubDate>Fri, 02 Dec 11 13:33:27 +0000</pubDate>
     <description><![CDATA[<p>Please ignore my previous comment, of course I can use txp:permlink</p>]]></description>
     <content:encoded><![CDATA[<p>Please ignore my previous comment, of course I can use txp:permlink</p>]]></content:encoded>
     <dc:creator><a rel="nofollow" href="http://www.caravanwise.co.uk/">Phil</a></dc:creator>
 
</item>

</channel>
</rss>