<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WordPress Hacks &#187; Rel Canonical</title>
	<atom:link href="http://wordpress-hacks.com/tag/rel-canonical/feed" rel="self" type="application/rss+xml" />
	<link>http://wordpress-hacks.com</link>
	<description>Tips y consejos de WordPress en español</description>
	<lastBuildDate>Fri, 30 Mar 2012 10:59:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Agregar rel=&#8221;canonical&#8221; en un par de líneas, sin plugins</title>
		<link>http://wordpress-hacks.com/agregar-relcanonical-sin-plugins.php</link>
		<comments>http://wordpress-hacks.com/agregar-relcanonical-sin-plugins.php#comments</comments>
		<pubDate>Sat, 06 Jun 2009 00:10:07 +0000</pubDate>
		<dc:creator>Neri Aispuro</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Rel Canonical]]></category>

		<guid isPermaLink="false">http://wordpress-hacks.com/?p=343</guid>
		<description><![CDATA[Escribo el post medio enojado con los "wp gurúes" y bloggers seguidos por muchos webmasters porque supuestamente "saben mucho", aunque solo se dediquen a recopilar enlaces en delicious. Estuve mirando un par de sitios que han hablado sobre el rel="canonical", y que, o han dicho de Instalar un plugin WTF! un plugin para una etiqueta de mierda?, o han dicho de modificar el functions.php para nose que. No entiendo si esta gente no tiene ganas de investigar un poco, si es tonta, si escribe por escribir, o simplemente se quieren hacer los que entienden sobre el tema agregando código que [...]]]></description>
			<content:encoded><![CDATA[<p><center><img src="http://wordpress-hacks.com/wp-content/uploads/2009/06/rel-canonical.jpg" alt="Rel canonical" /></center></p>
<p>Escribo el post medio enojado con los "wp gurúes" y bloggers seguidos por muchos webmasters porque supuestamente "saben mucho", aunque solo se dediquen a recopilar enlaces en delicious.<br />
Estuve mirando un par de sitios que han hablado sobre el <strong>rel="canonical"</strong>, y que, o han dicho de <strong>Instalar un plugin</strong> WTF! un plugin para una etiqueta de mierda?, o han dicho de modificar el <strong>functions.php</strong> para nose que.<br />
<strong>No entiendo</strong> si esta gente no tiene ganas de investigar un poco, si es tonta, si escribe por escribir, o simplemente se quieren hacer los que entienden sobre el tema agregando código que se puede simplificar el 80%.</p>
<p>Volviendo al tema y escribiendo un poco más en serio:<br />
Google, en conjunto con <del datetime="2009-06-05T22:26:00+00:00">Live</del> Bing, ask y Yahoo han lanzado hace un tiempito la etiqueta "canonical".<br />
Para los que no saben que hace esta etiqueta:<br />
Poniendo rel="canonical" en una url le estás diciendo a los robots que la url esa es la verdadera, un ejemplo gráfico:<br />
Para el artículo sobre el <a href="http://wordpress-hacks.com/nofollow-noindex-noarchive-y-mas-desde-el-header.php">NoFollow y NoIndex</a>, la url canónical es http://wordpress-hacks.com/nofollow-noindex-noarchive-y-mas-desde-el-header.php<br />
Mientras que hay tags y una categoría que tienen lo mismo:</p>
<p>http://wordpress-hacks.com/cat/tips</p>
<p>http://wordpress-hacks.com/tag/noarchive</p>
<p>http://wordpress-hacks.com/tag/noindex</p>
<p>http://wordpress-hacks.com/tag/nofollow</p>
<p>Es para combatir un poco el contenido duplicado.</p>
<p>¿Como hacer esto sin plugins ni códigos raros?<br />
Muy fácil, agregando el código que pongo abajo en el header.php, antes de &lt;/head&gt;</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">Ver texto plano</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> is_home<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;link rel=<span style="color:#FF0000;">"canonical"</span> href=<span style="color:#FF0000;">"&lt;?php echo bloginfo('url'); ?&gt;/"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> is_single<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;link rel=<span style="color:#FF0000;">"canonical"</span> href=<span style="color:#FF0000;">"&lt;?php echo get_permalink(); ?&gt;"</span>/&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La explicación del código: (aunque creo que está de más)<br />
La primer parte dice que si es home, muestre la url del sitio con rel="canonical".<br />
La segunda, si es single, o sea un artículo, muestra la url del mismo con rel="canonical".</p>
<p><strong><span style="color: #ff0000;">Atención</span></strong> con la terminación de la url de home. El código que les pasé es para las urls terminadas en "/", ejemplo http://wordpress-hacks.com<strong>/</strong><br />
Si su sitio es por ejemplo: http://wordpress-hacks.com sin la "/" al final, saquen ese caracter <img src='http://wordpress-hacks.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Pd: Ya se que con el plugin malo de <strong>all in one seo pack</strong> se hace con un par de clicks, pero como lo detesto, jamás lo recomendaría para hacer nada.<br />
Pd2: si alguien se sintió aludido que se cague.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress-hacks.com/agregar-relcanonical-sin-plugins.php/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

