déc
14
L-IPSE : Lancement de notre campagne de recrutement 2.0

Écrit par Jonathan | Publié le 2009-12-14

Ça y est, L-IPSE se lance et prend le virage Web 2.0 !!!

Nous lançons aujourd'hui une campagne de recrutement basée sur les réseaux sociaux.

Nous sommes à la recherche de conseillères et conseillers de talent, intéressé(e)s à joindre notre équipe !

Pour en savoir plus sur nos besoins, et pour visualiser et participer à notre campagne de recrutement:
Notre site Web: www.L-IPSE.com
Notre microsite de recrutement: http://changetavie.L-IPSE.com
Notre compte Twitter: www.twitter.com/L_IPSE
Notre page Facebook: http://tinyurl.com/yfaeyq9
Notre blogue L-IPSE: http://L-IPSE.blogspot.com/
Notre channel YouTube: http://www.youtube.com/user/LIPSEQC

Faites circuler la bonne nouvelle !


déc
07
Dynamic meta description and keyword tags for your MasterPages

Écrit par Jonathan | Publié le 2009-12-07

Today we're going to look at a technique for dynamically inserting meta tags into your master pages. By taking control of the head tag and inserting your own HtmlMeta you can easily customise these tags.

You might have noticed that when you create a new master page in visual studio your <head> tag gets decorated with a runat="server" attribute.

Asp.net doesn't add this kind of decoration to any other html tags (although you are free to add it if you want). So what makes the head tag special?

By adding the runat="server" you're giving actually converting the control into a HtmlHead control. That doesn't particularly matter for this tutorial other than to note that given a reference to the head control you get all the extras that come with asp.net controls such as access to its controls collection.

Why would you bother?

Neither the page meta description or meta keywords tags will do much for your sites ranking so why would you take the time to do this?

Well Google has gone on record to say that the keywords tag is not taken into account when ranking your score. Honestly I don't think its worth the effort to add the keywords into sites any more. I have seen some people give the opinion that it future proofs your site and that if Google ever does implement it into the algorithm then you will be ready. That seems like a fairly weak premise to base your decision on.

The description tag on the hand can be valuable. Perhaps not for ranking well in the search engines directly but more for the social engineering aspect. When you have get your result to appear in the search engine the text displayed from your meta description could make the difference between somebody clicking your site or your competitors.

Introducing the HtmlMeta control

The HtmlMeta control lets us wrap up <meta> tags via asp.net code. To add a meta description we need to create an instance, set the name property, the content property, and then add it to the head:

1 HtmlMeta meta = new HtmlMeta();
2 meta.Name = "description";
3 meta.Content = "this is a meta description tag";
4 head.Controls.Add(meta);

Its the exact same code for the keywords tag - you just change the name.

Public Properties

Instead of copying this code in every time you want to add meta tags to your page you can wrap these two concepts up in public properties which are easy to set.

The code would go in the code-behind file for your master page and would look something like this:

01 public string MetaDescription
02 {
03     set
04     {
05         HtmlMeta meta = new HtmlMeta();
06         meta.Name = "description";
07         meta.Content = value;
08         head.Controls.Add(meta);
09     }
10 }
11   
12 public string MetaKeywords
13 {
14     set
15     {
16         HtmlMeta meta = new HtmlMeta();
17         meta.Name = "keywords";
18         meta.Content = value;
19         head.Controls.Add(meta);
20     }
21 }

If you get red squigglies under the HtmlMeta in visual studio then you have probably just forgotten to include the System.Web.UI.HtmlControls namespace that it lives in:

1 using System.Web.UI.HtmlControls;

Further reading

Source : http://runtingsproper.blogspot.com/2009/10/dynamic-meta-description-and-keyword.html