Skip to content
Browse files

fixed error generating canonical urls on ads

  • Loading branch information...
1 parent 26937a6 commit 85ade012d319a8c84cc457a5e8e6fc0d0b28a94c @jipipayo jipipayo committed Apr 5, 2012
View
6 application/controllers/AdController.php
@@ -75,6 +75,9 @@ public function listAction()
$this->view->metaDescription = $this->view->translate($type) . ' ' . $this->view->woeidNameShort . '. ' . $this->view->translate('nolotiro.org is a website where you can give away things you no longer want or no longer need to pick them up other people who may serve or be of much use.');
+ //add link rel canonical , better seo
+ $this->view->canonicalUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/woeid/' . $woeid . '/' . $ad_type . '/status/' . $status;
+
//add the link to the proper rss to layout
$this->view->headLink()->appendAlternate('http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/rss/feed/woeid/' . $woeid . '/ad_type/' . $ad_type . '/status/' . $status,
'application/rss+xml',
@@ -298,7 +301,8 @@ public function showAction()
$this->view->metaDescription = $this->view->page_title . '. ' . $this->view->ad['body'];
//add link rel canonical , better seo
- $this->view->canonicalUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/ad/show/id/' . $id . '/' . $this->view->ad['title'] .'.html';
+ $this->view->canonicalUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $this->lang . '/ad/show/id/' . $id . '/' .
+ $this->view->slugTitle( $this->view->ad['title']);
//if user logged in, show the comment form, if not show the login link
$auth = Zend_Auth::getInstance();
View
10 application/languages/ca.csv
@@ -6,6 +6,12 @@
"Legal";"Avís legal"
"Terms";"Temes d'ús"
"Privacy";"Política de privacitat"
+"second hand and news";"segona mà i nous"
+"developers";"desenvolupadors"
+"contact";"contacta"
+"terms of use";"termes d'ús"
+"facebook group";"grup de facebook"
+
#search
@@ -97,8 +103,8 @@
"Choose a password (5 or more characters):";"escull una contrasenya( no més de 5 caràcters)"
"This username is taken. Please, try again.";"Aquest nom d´usuari ja existeix. Si us plau, tria´n un altre"
"The nolotiro.org team.";"l´Equip de nolotiro.org"
-"Welcome,";"benvingut,"
-"Change your nickname:";"canvia el teu nom d´usuari"
+"Welcome,";"Benvingut,"
+"Change your nickname:";"Canvia el teu nom d´usuari"
View
40 application/layouts/scripts/header_common.phtml
@@ -10,15 +10,25 @@
<meta name="google-site-verification" content="QvnYhzWWmqvuIm2pVRbYsu36hAAAoqsa_wYbAWZ_3mk"/>
<?php
//crawl but don't index the / page (to not appear on search engines, crawl /es or /en)
- if($this->metaRobots){
+ if ($this->metaRobots) {
$this->headMeta()->appendName('robots', $this->metaRobots);
}
//set hreflang and canonical urls for best multilanguage indexing by crawlers
if ($this->lang == 'es') {
$this->headLink(array('rel' => 'alternate', 'hreflang' => 'en', 'href' => str_replace('/es', '/en', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'fr', 'href' => str_replace('/es', '/fr', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'de', 'href' => str_replace('/es', '/de', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'ca', 'href' => str_replace('/es', '/ca', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'nl', 'href' => str_replace('/es', '/nl', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'pt', 'href' => str_replace('/es', '/pt', $_SERVER['SCRIPT_URI'])), 'APPEND');
}
if ($this->lang == 'en') {
$this->headLink(array('rel' => 'alternate', 'hreflang' => 'es', 'href' => str_replace('/en', '/es', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'fr', 'href' => str_replace('/es', '/fr', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'de', 'href' => str_replace('/es', '/de', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'ca', 'href' => str_replace('/es', '/ca', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'nl', 'href' => str_replace('/es', '/nl', $_SERVER['SCRIPT_URI'])), 'APPEND');
+ $this->headLink(array('rel' => 'alternate', 'hreflang' => 'pt', 'href' => str_replace('/es', '/pt', $_SERVER['SCRIPT_URI'])), 'APPEND');
}
if ($this->canonicalUrl) {
$this->headLink(array('rel' => 'canonical', 'href' => $this->canonicalUrl), 'APPEND');
@@ -38,21 +48,21 @@
<script type="text/javascript" src="/js/jquery.min.js"></script>
<?php
- echo $this->headMeta() .PHP_EOL;
+ echo $this->headMeta() . PHP_EOL;
echo $this->headLink() . PHP_EOL;
- echo $this->headScript() .PHP_EOL;
+ echo $this->headScript() . PHP_EOL;
?>
<script type="text/javascript">
if (typeof jQuery == 'defined') {
- $(function() {
- $.superbox.settings = {
- closeTxt: "<?= $this->translate('Close') ?>",
- loadTxt: "<?= $this->translate('Loading') ?>...",
- nextTxt: "<?= $this->translate('Next') ?>",
- prevTxt: "<?= $this->translate('Previous') ?>"
- };
- $.superbox();
- });
+ $(function () {
+ $.superbox.settings = {
+ closeTxt:"<?= $this->translate('Close') ?>",
+ loadTxt:"<?= $this->translate('Loading') ?>...",
+ nextTxt:"<?= $this->translate('Next') ?>",
+ prevTxt:"<?= $this->translate('Previous') ?>"
+ };
+ $.superbox();
+ });
}
</script>
@@ -62,7 +72,7 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-141609-7']);
_gaq.push(['_trackPageview']);
- (function() {
+ (function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
@@ -73,6 +83,8 @@
</script>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
- {lang: '<?php echo $this->lang ?>'}
+ {
+ lang: '<?php echo $this->lang ?>'
+ }
</script>
</head>

0 comments on commit 85ade01

Please sign in to comment.
Something went wrong with that request. Please try again.