30. November 2010 21:00
As of late, we've been trying to do some optimization on our ASP.NET MVC base projects that are the starting point for client builds. It is obvious that having META tags, particularly "Description" and "Keywords", on the .aspx pages of our sites is important. Moreover, the content of the tags has to be easily added to and/or updated on any given view's .aspx page.
As you're undoubtedly aware after Googling this topic, most online help will have you instantiate an BaseViewData class on your Master page or write tags by implementing some variance of a base Page/Interface/Abstract class.
After experimenting with a number of these methods, I concluded that the KISS (Keep it Simple Stupid) principle should apply.
The bottom line is this: Save your sanity, and be thanked by the next guy that has to work on your project. Add a MetaContent <asp:ContentPlaceHolder> to your Site.Master page and be done with it.
When you start a new MVC site, the Site.Master head section should look like this:
<asp:ContentPlaceHolder ID="TitleContent" runat="server" />
We're going to add another <asp:ContentPlaceHolder> that contains some default values, More...
Sciosoft Systems is a Canadian web design & development company based in Muskoka,
which is in central Ontario. We provide ASP.NET website & Windows Server application
development services to small and medium-sized business, as well as local government
and not-for-profit groups. If you have a website project you’d like to discuss,
please visit us at www.sciosoft.com.