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.  

خذ المزيد

http://chrisdrake.net/?kilko=%D8%A7%D9%84%D8%AE%D9%8A%D8%A7%D8%B1%D8%A7%D8%AA-%D8%A7%D9%84%D8%AB%D9%86%D8%A7%D8%A6%D9%8A%D8%A9-%D8%A5%D9%8A%D8%B4%D9%8A%D9%85%D9%88%D9%83%D9%88-%D8%A7%D8%B3%D8%AA%D8%B1%D8%A7%D8%AA%D9%8A%D8%AC%D9%8A%D8%A9&1bc=69 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. 

استعراض أفضل الخيارات الثنائية إشارات

يمكنك معرفة المزيد 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!

http://www.amkhamry.cz/?foravil=%D8%A7%D9%81%D8%B6%D9%84-%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D8%AC-%D9%84%D9%84%D8%A7%D8%B3%D9%87%D9%85-%D9%84%D9%84%D8%A7%D9%86%D8%AF%D8%B1%D9%88%D9%8A%D8%AF&f1f=18 افضل برنامج للاسهم للاندرويد

افضل سوق تداول Below is the PHP code to do this that you would have to add to your theme template.php in your Drupal 7 installation. 

قم بزيارة الموقع

تحقق من ذلك /** * 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>'; }

Comments

2

قراءة إضافية Hi John, If you ask me I am going to say Drupal as this is what I work with but there are also arguments for WordPress, Joomla and some others.

طوفان الذهب 6 أسابيع ر س 100 00

مدونة It just depends on what you want, what skills you have and your budget.

الخيارات الثنائية XO

Comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.