SEO Localization - nicholashew/DnnFreeSourceTabLocale GitHub Wiki

Create a Custom Skin Base

using DotNetNuke.Framework;
using DotNetNuke.Framework.JavaScriptLibraries;
using FreeSource.Modules.TabLocale.Components;
using System;
using System.Web.UI.WebControls;

namespace Sample.Skin
{
    public class SkinBase : DotNetNuke.UI.Skins.Skin
    {        
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            RegisterJavaScript();

            if (!Page.IsPostBack)
            {
                try
                {
                    LocalizedTabInfo localizedTab = TabLocaleController.GetLocalizedTab(PortalSettings.ActiveTab, true);
                    if (localizedTab != null)
                    {
                        var basePage = (CDefault)Page;
                        basePage.Title = localizedTab.LocalizedTitle;
                        basePage.KeyWords = localizedTab.LocalizedKeywords;
                        basePage.Description = localizedTab.LocalizedDescription;
                        basePage.Comment += "<META HTTP-EQUIV=\"Content-Language\" content=\"" + System.Threading.Thread.CurrentThread.CurrentUICulture.Name + "\">";

                        if (!String.IsNullOrEmpty(localizedTab.LocalizedPageHeadText))
                        {
                            var litPageHeadText = new Literal
                            {
                                Text = localizedTab.LocalizedPageHeadText
                            };
                            Page.Header.Controls.Add(litPageHeadText);
                        }
                    }
                }
                catch (Exception)
                {
                    //ignore
                }
            }
        }
        
        private void RegisterJavaScript()
        {        
            JavaScript.RequestRegistration(CommonJs.jQuery);
        }
    }
}

Inherits Custom SkinBase in Skin Layout

<%@ Control Language="vb" AutoEventWireup="false" Explicit="True" Inherits="Sample.Skin.SkinBase" %>
<div id="ContentPane" runat="server"></div>
⚠️ **GitHub.com Fallback** ⚠️