Customising theme_link to always add a relevant title tag for the SEO of your site إيزي فوركس
Customising theme_link to always add a relevant title tag for the SEO of your site When building this site I wanted the links to all have the site name in the title tag as the keywords in the site name are what I want to be indexed for by Google. To do this I have made a simple theme_link function override to append the site name to the title tag if it is not already present.  

الخيار الثنائي الموالية مراجعة الإشارات While I was doing this I also noticed that not all of my links had the title of the page they were linking to in the title tag and as I didn't want to trawl through all of my code to try to find where I had been lazy and not added these in manually I also added the functionality to this theme link function to get the title of the page we are linking to and insert this in to the title tag as well. 

follow site

follow site The results are pretty good, all the links on this site are run through this function so you can see the results for your self, I am hoping this will help with the SEO!

الأستثمار في الذهب

دليل إستخدام الخيارات الثنائية Below is the PHP code to do this that you would have to add to your theme template.php in your Drupal 7 installation. 

follow link

طريقه المتاجرة بالذهب follow /** * Overrides the theme_link function to add the page title and site name to * all links, even if not provided. * * @param array $variables * @return string */ function mytheme_link($variables) {   // Add the site name variable to the end of link titles for SEO static $site_name; if (empty($site_name)) { $site_name = variable_get('site_name'); }   $attributes = $variables['options']['attributes']; $text = trim(check_plain(strip_tags($variables['text']))); if (!empty($attributes['title'])) { if (mb_strpos($attributes['title'], $site_name) === FALSE) { $attributes['title'] .= " | " . $site_name; } } else { $normal_path = drupal_get_normal_path($variables['path']); $item = menu_get_item($normal_path); if (!empty($item['title'])) { $attributes['title'] = $item['title'] . " | " . $site_name; } elseif (!empty($text)) { $attributes['title'] = $text . " | " . $site_name; } else { $attributes['title'] = $site_name; } }   return '<a href="' . check_plain( url( $variables['path'], $variables['options'] ) ) . '"' . drupal_attributes($attributes) . '>' . ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text']) ) . '</a>'; }




By submitting this form, you accept the Mollom privacy policy.