asp.net-mvcasp.net-mvc-3uiculture

MVC 3 building dynamic meta keywords meta description functionality for multi-culture site


I need to create db driven meta keywords/description. I would store these records in a database, xml format i presume; since it would be per culture.

How would i go about doing this?

any feedback, suggestions, help, greatly appreciated. thanks


Solution

  • What you need to change is just the call to method that returns the keywork/description

    You can use Thread.CurrentThread.CurrentUICulture to determine the user culture.

    You need to change at web.config to auto change the culture.

    Ex.: (Web.Config)

    <globalization uiCulture="auto" culture="auto" />
    

    (Controller)

    ViewBag.Description = GetDescription(pageId, Thread.CurrentThread.CurrentUICulture.Name)
    

    (View)

    <meta name="description" content="@ViewBag.Description ">