Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Dynamically set the title and meta description and keyword tagsDynamically set the title and meta description and keyword tags
Previous
 
Next
New Post
5/2/2007 3:45 PM
 

For SEO implications.   In your module... (in C#)

((DotNetNuke.Framework.CDefault)this.Page).Title = "This page's new title";
((DotNetNuke.Framework.CDefault)this.Page).Description = "some description...";
((DotNetNuke.Framework.CDefault)this.Page).KeyWords = "some keywords";

These are moved to the final resting place in Default.aspx.vb in Page_PreRender.

For extra credit, can someone figure out the right way to change the ROBOTS meta tag dynamically?  i.e., I'd like to set certain, admin-ish pages available to end-users to be NOINDEX.

 

(Okay, perhaps most of this is obvious to the non-newbie, but after googling around I didn't find the answer...)

 

 

 
New Post
5/3/2007 9:11 AM
 

pgaston wrote

For extra credit, can someone figure out the right way to change the ROBOTS meta tag dynamically?  i.e., I'd like to set certain, admin-ish pages available to end-users to be NOINDEX.

Easy, since the <HEAD> tag is set to 'runat="server".' Put this in the PreRender event handler:

For Each obj As Object In Head.Controls     ' <<< or >>>  For Each obj As Object in Page.Header.Controls
   If obj.GetType Is GetType(HtmlMeta) Then
      Dim meta As HtmlMeta = CType(obj, HtmlMeta)
      If meta.Name.ToLower = "robots" Then
         meta.Content = "NOINDEX, NOFOLLOW"      '<<< whatever value you want it to have
      End If
   End If
Next

Or, if you need C#--

foreach (object obj in Head.Controls)  // or // foreach (object obj in Page.Header.Controls)
{
 if (obj.GetType == typeof(HtmlMeta))
 {
   HtmlMeta meta = ((HtmlMeta)(obj));
   if (meta.Name.ToLower == "robots")
   {
     meta.Content = "NOINDEX, NOFOLLOW";
   }
 }
}

 
New Post
5/3/2007 6:10 PM
 

Thanks, works like a charm!   Here it is with the VB-ish removed...



using System.Web.UI.HtmlControls;     // at top


// in PreRender for page


foreach (object obj in Page.Header.Controls)

{

 if (obj.GetType() == typeof(HtmlMeta))

 {

  HtmlMeta meta = (HtmlMeta)obj;

  if (meta.Name.ToLower() == "robots")

   meta.Content = "NOINDEX, NOFOLLOW";

 }

}
 
New Post
5/4/2007 7:01 AM
 

pgaston wrote
Thanks, works like a charm!   Here it is with the VB-ish removed...

"VB-ish" ?  LOL!

My personal opinion... If you really want to have all doors open to you, learn and be expert in BOTH languages!

Glad I could help.

 
New Post
5/4/2007 9:02 AM
 
:)

Heck, I've been doing this C# thing for years now and I'm still learning! For better or worse I started this project (www.radioshowlinks.com) with the ASP.Net Portal Starter Kit 4 years back and wish to migrate/upgrade to DNN - the downside being a reasonable amount of working 'legacy' code in C#. So for now I'm hanging in there with C# -- using C# for module development seems to work very well so far, despite occasionally having to muck around in the core source code in VB... (and it limits any temptation to modify the core!)

Cheers - and thanks again!!!
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Dynamically set the title and meta description and keyword tagsDynamically set the title and meta description and keyword tags


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Copyright 2014 by DNN Corp | Terms of Use | Privacy | Design by Parker Moore Design