Improve page priority feature of DNN's Google SiteMap

Blog 2
Location: BlogsAll BlogsDNN Development    
Posted by: mamlin 7/2/2008 10:07 PM

DotNetNuke provides a Google-ready XML sitemap to help you get your pages indexed and ranked in Google search results.  Unfortunately, the current implementation sets every page's "priority" ranking to the same fixed value.  Because of this, no page ever gets priority over any other.  Fortunately there's a simple improvement you can make (using Notepad) to give priority to certain pages without changing any core DNN functions...

DNN SiteMap
As many of you are already aware, DNN provides an XML sitemap feature to help you get your portal(s) indexed on search engines.  An XML sitemap is more search-engine friendly than the easy-to-read (human-friendly) sitemaps.  In fact, the XML sitemap specification is now supported by a number of search engines including Google, Yahoo, MSN, Ask and more.  You'll therefore want to include a link on your website to the XML "SiteMap" even if you already have a separate human-friendly version available.

If you're not familiar with the DNN XML sitemap, you can view the map for any DNN portal by browsing to that portal's "sitemap.aspx" page:   http://(your URL)/sitemap.aspx 

You can see a popup window of the sitemap for this site here:  http://eguanasolutions.com/sitemap.aspx

 
Page Priority
If you look closely at the sitemap results, you'll see a field titled "priority".  The value inside of this field tells a search engine how important you consider that page to be.  Valid priority values range from "0.0" to "1.0".

Example:  Let's say you've created an online comic book.  You've linked together individual web pages with one web page per comic book page.  You probably consider the very first page of the comic to be more important than any other page in terms of search results.  That is, you probably would prefer to drive incoming visitors to the first page of the comic rather than have them land on some page in the middle of the comic.  If you divided your book into chapters, the first page of each chapter would also be given priority over other pages.  So you might give your site's homepage a priority value of "1.0", the starting page of the comic a value of "0.9", the starting pages of chapters a value of "0.8" and all other pages some value below "0.8".


DNN's Broken Page Priority

DNN assigns every page a priorty of "0.8" on a scale of "0.0" to "1.0".  This is not the result of "broken" functionality -- it's actually hard-coded that way.  As far as DNN site owners are concerned, however, it's "broken".  Until the DNN team addresses this point, the page priority value provides no benefit since no page ever gets priority over another.

What's needed is a way to influence page priority without changing core DNN code (changing core code is bad for a number of reasons).


Upgrading Your SiteMap
Fortunately the SiteMap is implemented as a standalone ASPX page rather than as a dynamically-created page as most other DNN portal pages are.  This means that we can alter the SiteMap code without changing any other DNN code.  Better still, we can easily backup our original sitemap files (there are only two files) under a different filename so they're readily available to switch back to if needed.  Even better, we can do it all with nothing more than Notepad.

Our simple upgrade will work as follows:

  • Every page gets a default priority value of "0.5".
  • If a DNN page has a DESCRIPTION set for it (defined under that page's SETTINGS), that page's priority value is increased by "0.1".
  • If a DNN page has any KEYWORDS set for it (defined under that page's SETTINGS), that page's priority value is increased by "0.1".

So, we can increase a particular page's priority by defining a description and/or by assigning keywords.  Are you already setting descriptions and keywords for all of your pages?  You're still in luck:  although this basic solution won't allow you to further increase page priority, it will have the happy result of decreasing priority for any pages with no content.  That is, menu tabs that exsist solely to provide menu links to child pages will get lower priority over the child pages that have actual content (assuming you did not assign descriptions and keywords to those empty pages).

Of course, there is nothing to stop you from further enhancing your site map to allow specific page prioritization -- we'll get into that near the end.


Steps for the Basic Site Map Upgrade:

(1) Open "SiteMap.aspx.vb" with Notepad.  Select FILE->SAVE AS and save the file as "Original_SiteMap.aspx.vb".  (This is our backup copy of the codebehind file -- just in case!)  Close the file.
 
(2) Open "SiteMap.aspx.vb" (again).

(3) In the file "SiteMap.aspx.vb", find line 90.  (Hint:  Be sure you have VIEW->STATUS BAR active in Notepad so you can see what line and column the cursor is on.)

Line 90 should be:    Dim objTabs As New TabController

Immediately after line 90, insert this line:  Dim pagePriority As Single

(4) Now find line 96.  It should be:  If intURLs < SITEMAP_MAXURLS Then

Immediately after line 96 insert this line:   pagePriority = 0.5

(5) Now find line 103.  It should be:  sb.Append(BuildURL(URL, 2, pagePriority))

Replace line 103 with all of the following:

   If objTab.Description.Length > 0 Then
      pagePriority += 0.1
   End If
   If objTab.KeyWords.Length > 0 Then
      pagePriority += 0.1
   End If
   sb.Append(BuildURL(URL, 2, pagePriority))

(6) Moving on, find line 121.  It sould be:

   Private Function BuildURL(ByVal URL As String, ByVal Indent As Integer) As String

Replace line 121 with:

   Private Function BuildURL(ByVal URL As String, ByVal Indent As Integer, ByVal pagePriority As Single) As String

(7) Finally, locate line 129.  It should be:

   sb.Append(WriteElement("priority", SITEMAP_PRIORITY, Indent + 1))

Replace line 129 with this:

   sb.Append(WriteElement("priority", pagePriority, Indent + 1))

Save your file "SiteMap.aspx.vb".

That's it.  Test it out by broswing to the updated sitemp:

     http://(your site's URL)/SiteMap.aspx

A NOTE ABOUT CACHE: If you've recently viewed your old sitemap file then the output may be cached on your web server  (you won't immediately see your changes).  You'll either have to recycle the web server (restart IIS on a Windows machine) or, in a hosted environment, wait until your host's cache expires.  An easy way around this (for testing purposes) is to append a unique querystring to your URL.  You'll have to give a new unique string for each view in order to avoid viewing a cached result.  
Example:  For your first view, use
  http://(your site's URL)/SiteMap.aspx?q=1  
For your second view, use
 
http://(your site's URL)/SiteMap.aspx?q=2  
...etc...
 
 
Getting Your SiteMap Searched
Once everything is just the way you like, be sure to add a link on your site's homepage (at the least) to the "SiteMap.aspx" page so it can get indexed by the various search engines.  Also, if you manually submit your site to a search engine for indexing, it's a good idea to also submit a direct link to the "SiteMap.aspx" page if specific page submissions are allowed.

You can find the full URL for your sitemap under the ADMIN settings.  For DNN versions 4.x, the URL is "fixed" to a specific path.  You don't have to use the "fixed" path and filename as specified by DNN but, if you use a different path and/or filename for your sitemap file, be sure to submit your actual sitemap URL to Google rather than the default URL as hard-coded in DNN.  
 
To see DNN's default sitemap URL, browse to:

  ADMIN -> SITE SETTINGS

Look for the "Site Marketing" settings under "Basic Settings".  Find the "Site Map URL" value to see the full URL of your "SiteMap.aspx" file:

     http://(your site's URL)/SiteMap.aspx


Taking Complete Control of Page Priority Values
Now that you know about the DNN SiteMap and have your own, standalone version to play with, you can expand what we've started and give yourself complete control over page priority values. How you do that is up to you, but one easy solution (without changing any core DNN code) would be to define your own "priority" token to include as part of your page's keywords.

Example:  Let's call our token "PPV" (Page Priority Value).  We can assign values simply by making them part of the token:

   Priority 0.0 = "PPV00", priority 0.5 = "PPV05", etc.

We'd then add appropriate code to "XMLSiteMap.aspx.vb" to parse the collection of keywords for a page, looking for any 5-character keywords beginning with "PPV".  We'd then set that page's priority by parsing the fourth and fifth characters and concatenating them into a single value of the form "x.y".  This value would override any default or derived priority value.

Hopefully the DNN team will soon add page priority features to the framework itself.  If not, perhaps I'll revisit this theme in the near future and implement the custom token feature I described.
 
EDIT 4/6/2009:  Fellow DNN'er Dylan Barber read this post and went off and implemented my humble Page Priority Value idea in a nice, simple little block of code (only 8 lines long).  Check out Dylan's solution on his Pants Optional! site.
 
 
More... (added 3/19/2009)
I've written a follow-up to this post here:  http://www.eguanasolutions.com/DNN_Blog/EntryID/20.aspx
 
The follow-up touches on Google's "Page Priority Warning", gives direct submittal links to several indexers other than Google to submit your sitemap to and goes into a discussion about the priority "rules" I've applied in this posting and that have been commented on by readers.

Permalink |  Trackback

Comments (21)   Add Comment
Re: Improve page priority feature of DNN's Google SiteMap
Abbas    10/2/2008 2:24 PM
Dear mamlin, <br>Thanks for your article. I feel great that found your article finally. I like your method because you did not try to change the core module. I followed your instrauctions and you are able to see my site map in http://www.becswebdesign.com.au/xmlsitemap.aspx but it still won't solve my problem in google web master tools: "WARNING All the URLs in your Sitemap have the same priority. All the URLs in your Sitemap are set to the same priority (not the default priority). Priority indicates the importance of a particular URL relative to other URLs on your site, and doesn't impact your site's performance in search results. If all URLs have the same priority, Google can't tell which are more important". <br><br>I set keywords and description for all pages. I am looking for another parameters to set the priority of the page like the most visited pages to effect on page priority or maybe an indivisual module which allows me to set the priority for different pages manually.<br><br>Thanks for your time and patience and best regards! Abbas Heidari

Re: Improve page priority feature of DNN's Google SiteMap
mamlin    10/2/2008 3:07 PM
Thanks for the feedback, Abbas. It's great that you set both descriptions and keywords for -every- page but, as you said, that means my simple upgrade doesn't really help you. It sounds like you need the solution I mentioned in the final section ("Taking Complete Control..."). Add sitemap code to parse each of a page's keywords and look for whatever special keyword(s) you added to set a page's priority. I suggested using keywords "PPV00" up to "PPV10" and then having the sitemap code pick the strings apart to contruct the page rank values "0.0" up to "1.0". However, there is nothing to prevent you from keeping things simple and just use the actual ranking value "0.0" up to "1.0" as your special pagerank keyword. It's unlikely that you'd use such a number as a REAL keyword so there should be little chance of a special pagerank value conflicting with other keywords. All you'd need to do in the sitemap code is look for the first three-character keyword to match the pattern "x.y" where x and y are numbers. A simple regex check would do that for you with ease. Since you've posted a comment with your interest on this issue I'll take a look at writing a "Part 2" to my Google Sitemap post and see about implementing such a solution.

Re: Improve page priority feature of DNN's Google SiteMap
Autocall    1/11/2009 1:42 AM
I can't seem to change the Site Map URL under Site Marketing. I'm logged in as Host. My site is hosted by Network Solutions and the DNN install was done on their servers so the value that's in there is a third level URL with sitemap.aspx. I got the Google error about the same priority and did your fix which worked like a charm, now I want to edit that Site Map URL. Also, I'm assuming it's easy to set the default to .6 and bump up .2 for keywords and .1 for description as easily as it seems, right?

Re: Improve page priority feature of DNN's Google SiteMap
mamlin    1/11/2009 8:38 PM
Autocall- Yes, you can change the priority values easily -- just make sure your priority totals always fall on or between "0.0" and "1.0". To set the default to "0.6" instead of "0.8", change the value set for 'SITEMAP_PRIORITY" near the top of the file. As for changing DNN's sitemap URL location, I have made an oversight in my original blog posting. It seems that DNN sets a fixed URL for the sitemap (no, not even HOST can change it). What you see on the ADMIN settings page is only there for informational purposes. It's confusing since you're shown the non-editable URL in a textbox that's presented exactly like other edit-able textboxes. You can have any sitemap path/name you like as long as your sitemap resides within the same domain as your website and you manually report the correct URL to Google (this is what I do). Sorry for the confusion -- I've updated the blog posting to reflect this limitation in configuring the sitemap URL. The easiest thing to do is to simply rename your original sitemap files to something else and name your new sitemap files using DNN's "fixed" name (without the "XML" preface).

Re: Improve page priority feature of DNN's Google SiteMap
geertdo    3/8/2009 2:19 PM
A little improvement on line 129 for correct formatting: pagePriority.ToString("F1", CultureInfo.InvariantCulture) Thanks for your article!

Re: Improve page priority feature of DNN's Google SiteMap
Ronny Bartsch    3/19/2009 6:53 AM
Heres a simple workaround for having full control about page priority depending on KeyWordsLength: Add some If-Cases to increase page-priority with 0.1 if KeyWords.Length > 40, KeyWords.Length > 80, KeyWords.Length > 120 and so on. Thank You very much for your article. It is a great help!

Re: Improve page priority feature of DNN's Google SiteMap
mamlin    3/19/2009 7:12 AM
Ronny- That's a great idea and it also happens to correlate closely with my general "if you care enough..." page priority rules I talked about in a later post: http://www.eguanasolutions.com/DNN_Blog/EntryID/20.aspx I think I would keep the current logic (+0.1 if -any- keywords are present) but lower the "default" priority value of all pages to 0.1 to leave planety of room to then add the results of a length-based formula such as: (keywords.length * 0.025) This would result in +0.1 for every 40 characters of keywords or, if rounding the formula results to the nearest tenth, +0.1 for the first 20 characetrs and +0.1 for each additional set of 40 characters. Great suggestion! I'll add it to my follow-up article (linked above). Thanks for commenting and sharing.

Re: Improve page priority feature of DNN's Google SiteMap
mamlin    3/19/2009 9:56 AM
I've added Ronny's idea (and gave credit to Ronny, of course) to my follow-up post here: http://www.eguanasolutions.com/DNN_Blog/EntryID/20.aspx

Re: Improve page priority feature of DNN's Google SiteMap
Christopher    4/6/2009 3:33 PM
I made all changes in my SiteMap.aspx.vb , but now I have new problem , i translate from PL language comment to english: 62 Bad value tag ___ This tag XML have bad value. Correct and send again: ___ Tag: ___ Value: ___ url ___ priority ___ 0,7 ___ 01-04-2009 ___ I change SITEMAP_PRIORITY to 0.5 from 0.8 but I still have this error. My version DNN is 4.9.2. Any idea ?

Re: Improve page priority feature of DNN's Google SiteMap
mamlin    4/6/2009 3:39 PM
Christopher- I'm sorry I can't give much insight as to the cause of the error you have encountered. I've not run into that error myself. I'd start by looking for a malformed tag pair in the generated sitemap.aspx output. Could you post the full URL to your "sitemap.aspx" file?

Re: Improve page priority feature of DNN's Google SiteMap
John Croson    5/21/2009 7:05 AM
Nice hack, and great article! I initially found a post in the DNN forums about this here: http://www.dotnetnuke.com/tabid/795/forumid/108/threadid/237946/scope/posts/threadpage/5/Default.aspx which kept my site from being seen as a problem by Google. __ John Croson http://www.ihbsonline.com http://pcnorb.blogspot.com http://www.croson.us

Re: Improve page priority feature of DNN's Google SiteMap
mamlin    5/21/2009 7:16 AM
John- Thanks for the comments and for the nice mention and link in your blog post regarding the Page Priority issue in the current DNN sitemap. I hope you also had a chance to read my follow-up blog post (I included the same ideas in the DNN forum thread you linked) regarding page priority based on menu level. That approach is not appropriate for sites where your most important content is -not- at the top level of the menu. The real solution is a sitemap with user-selectable options so site admins can configure the priority rules to match the structure of their site's pages and content. ____ For everyone else, you can read about John's DNN sitemap experience and findings in his own Blogger posting here: http://tiny.cc/Wphx4

Re: Improve page priority feature of DNN's Google SiteMap
Pakistani Boutique    10/1/2009 12:07 PM
Yes I agree. Don't set priority same for all pages. Google think you are cheating. Better set automatic priority like we did with our Pakistani Boutique http://***.*****.***

Re: Improve page priority feature of DNN's Google SiteMap
mamlin    10/1/2009 12:33 PM
Pakistani Boutique- Thanks for the comments. Regarding the blanked URL in your comment: We don't typically allow comment links back to sites that do not somehow contribute to the topic at hand (such as your PHP-based store site). Considering the topic of this post, I would have considered a link directly to your site's sitemap showing tiered page priority values, but not just a link to the site's homepage. Such a link would seem to be shared mostly for driving traffic and improving Google page rank and not so much as a contribution to this blog topic. On a separate note: You may want to look at item "Designer-Lehenga-803" as it seems to unintentionally appear multiple times in a row within certain store categories.

Re: Improve page priority feature of DNN's Google SiteMap
DotNetNuke developer    6/5/2010 7:35 AM
Hey hi mamlin , i really feel good to read your post, its very interesting at the same point very useful too.... i definitely got answer to my queries i had before reading your post. Take care .

Re: Improve page priority feature of DNN's Google SiteMap
Will    10/19/2010 4:53 PM
I've made a sitemap and am wondering whether to set the domain name www.mydomain.com to 1 or the domain name AND index page www.mydomain.com/index.html also to 1? or should the index page itself be 0 and the domain 1?

Re: Improve page priority feature of DNN's Google SiteMap
mamlin    10/19/2010 5:01 PM
I'd give both a value of "0" for top priority. Remember that the priority value is just a suggestion for parsing engines/robots. Either the value will be ignored, accepted "as-is" or, most likely, processed in some unique manner based on logic within the visiting parsing/processing engine. Processing logic is, after all, what has historically differentiated most search engines from each other. It's possible some engines may process more to your liking if you give different values but, on the whole, since both URLs you mention resolve to the same target I believe both should get the same value.

Re: Improve page priority feature of DNN's Google SiteMap
SEOanalyst    9/29/2011 11:26 AM
in these days I would call it more like SEO

Re: Improve page priority feature of DNN's Google SiteMap
larry    10/29/2011 7:22 PM
its difficult to tell Google what is important

Re: Improve page priority feature of DNN's Google SiteMap
larry    10/29/2011 7:23 PM
and what about SEO

Re: Improve page priority feature of DNN's Google SiteMap
eguanaman    11/8/2011 10:12 PM
very good advices, thank u very much


Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 
You are here:  
 
>> Back to the top of the blog list...

 
        account   blog   click   cloud   code   create   data   events   example   feature   file   files   free   function   good   google   just   line   links   list   module   modules   need   note   number   option   page   pages   query   results   role   roles   script   search   select   settings   simple   site   skin   solution   step   tags   terms   time   user   users   value   version   want  
Minimize Google AJAX Search
 
Search ES:  
This is an example of a Google AJAX Search with asynchronous search execution for two searches.  See our blog series, 'Add Google AJAX Search to your DNN skin' for info and sample code.
 
     
Minimize Buy Stuff
 
Stuff by Eguana Solutions
(Be sorta cool!)
 
     
Minimize Most-Commented Blogs
 
 
     

Minimize Looking for more info?
 

There are tons of helpful
posts from Eguana Solutions 
on the DotNetNuke.com forums.
  
 
Click HERE to see our posts.

 
     
Minimize Modules for Sale
 

Looking for Eguana's modules? 
We're still working on them!
  

Until ours are ready to dazzle and
amaze, you'll have to make do with
the thousands of modules already
available on SnowCovered.

 
     
Minimize Favorite Modules
 

There are many great DNN modules.
A few we highly recommend are:
 
Dynamic Registration
Total control over the user signup process.  Create custom forms, execute your own SQL, use the integrated payment processing features to assign user roles, validate USERNAMEs via AJAX and much more.  Very cool.
 
URL Master
Change to friendly URLs that really ARE friendly.  Add keywords into your page URLs for better SEO.  Create 301 redirects for individual pages.  Force visitors (and search bots) to a single domain (i.e., make everyone use the "www" version of your site's URL or vice versa).  One of the single best upgrades for any DNN site.
 
Document Exchange 5 (DMX5)
Drag-and-drop from Windows Explorer directly into the DMX file manager!  File versioning, file and folder moderation, extend user permissions down to the file level (for user groups and even for individual users).  Infinite file and file info presentation options via custom display templates.  Store files locally or remotely via UNC (i.e., can securely store files somewhere besides your web server).  Much more.
 
XMOD by DNNDev
Rock-solid form module for data collection.  From simple feedback / email forms to complex, multi-part tabbed forms.  XMOD is different from other form modules because XMOD does not create a new database table for every new form definition -- an important feature if you plan to create dozens or hundreds of forms over the life of your DNN instance!  Excellent support from the developer and an active community around this module.
 
If you desire your form module to create a new DB table for each new form definition, a great alternative to XMOD is the Dynamic Forms module from DataSprings.  Dynamic Forms offers direct DB access beyond that found in XMOD as well as an easy drag-and-drop form builder option to help you get up and running very quickly.

 
     

Login