InstantASP Community Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


««12

Changing Title & Meta Tags Expand / Collapse
Author
Message
Posted 27/02/2006 07:50:38
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 02/01/2007 12:46:48
Posts: 12, Visits: 74
Warning: Do not attempt this if you don't know what it is doing!

If you are willing to do a hack which isn't very pretty, and totally at your own risk... (But you can do it with the End Users version). It will give your start page a bit of a weird description, but should give you a semi decent description for the rest of your pages assuming you have decent topic titles and topic descriptions. Change the bits in red to the name of your forum or it won't make much sense...

To summarise what will happen:

In a Forum/Category:

  • With description Meta Description becomes:
    Discuss Forum Name in Your Forum's Name: Forum Description
  • Without description Meta Description becomes:
    Discuss Forum Name in Your Forum's Name

In a Topic/Other Page:

  • With description Meta Description becomes:
    Discuss Page Title in Your Forum's NameTopic Description
  • Without description Meta Description becomes:
    Discuss Page Title in Your Forum's Name

It works well appart from the first page gets called:

Discuss Your Forum's Name in Your Forum's Name

Though use at your own risk. I have not tested it fully nor am I aware of potential side effects this may cause.

Pop in and edit this file:
\InstantASP.InstantForum\InstantASP.InstantForum.UI\MasterPages\MasterTemplate.vb

Change the Page_Load in the  #region Page Events to:

Public Sub Page_Load(ByVal sender As Object , ByVal e As System.EventArgs)

Dim aString As String = InstantASP.InstantForum.Formatters.Control.FormatPageHeader(InstantForumHeader, CurrentContext)
Dim header As New System.Text.StringBuilder(aString)
Dim indexStart As Integer = aString.IndexOf("<title>") + 7
Dim indexEnd As Integer = aString.IndexOf("</title>", indexStart)
aString = aString.Substring(indexStart, indexEnd - indexStart)
If Not CurrentContext.CurrentTopic Is Nothing AndAlso currentContext.CurrentTopic.TopicID > 0 Then

If CurrentContext.CurrentTopic.Description.Length > 0 Then

header.AppendFormat("<meta name=""description"" content=""{0} in Your Forum's Name: {1}"" >", aString, CurrentContext.CurrentTopic.Description)

Else

header.AppendFormat("<meta name=""description"" content=""Discuss {0} in Your Forum's Name"" >", aString)

End If

ElseIf Not CurrentContext.CurrentForum Is Nothing AndAlso CurrentContext.CurrentForum.ForumID > 0 AndAlso CurrentContext.CurrentForum.Description.Length > 0 Then

header.AppendFormat("<meta name=""description"" content=""Discuss {0} in Your Forum's Name: {1}"" >", aString, CurrentContext.CurrentForum.Description)

Else

header.AppendFormat("<meta name=""description"" content=""Discuss {0} in Your Forum's Name"" >", aString)

End If
InstantForumHeader.InnerHtml = header.ToString

End Sub

Cheers

Jeremy





Jeremy Hopkin
The Wine Community Forums for Champagne Reviews
Post #10189
« Prev Topic | Next Topic »

««12

Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ryan Healey, Mark Christianson, Bare, James Trott

Permissions Expand / Collapse

All times are GMT, Time now is 12:33pm

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.063. 10 queries. Compression Disabled.
Home | Products | Purchase | Support | Company | Contact Us
Privacy Statement | © 1999-2007 InstantASP Limited. All Rights Reserved.