Showing posts with label WCM. Show all posts
Showing posts with label WCM. Show all posts

Thursday, August 21, 2008

How to add MOSS search to internet explorer 7 search box

This is a rather easy and cool task...

May time people ask me how they can add their SharePoint search to the internet explorer 7 search box:


Now, I know... if you have internet access - there is no problem. Just click on the "Find more providers" and follow the instructions and you are done.

But - some customers do not have internet access on their client machine, or some administrators would like to publish this configuration through an organization... so a little registry tweaking will do the trick!

Simple take this text:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\{33093C07-A5A2-418A-AB53-C187BC95DAED}]
"DisplayName"="KWizCom Portal Search"
"URL"="http://portal.kwizcom.com/searchcenter/Pages/Results.aspx?k={searchTerms}"


Replace the "KWizCom Portal Search" with the search provider title you want,
Replace the URL address with the one of your search page (to find out what it is - Simple do a search and copy the resutls page address), and replace the word(s) you searched for with the {searchTerms} token.

Save it as a search.reg file using notepad, and run it!

Also, you can add almost any other search provider in the same way, for example to search in KWizCom addons site you can use this search address:
http://www.kwizcom.com/search.asp?SearchString={searchTerms}&pageID=1


Easy, isn't it?

Wednesday, June 18, 2008

How to improve SEO of you WCM sites

Well, as many of you might know - the most important thing for an internet facing web site is to be found easily in the leading search engines.

Because it does not matter how nice and sexy you "pimped" your web site, nor how relevant and profound is the content - if no one can find it your web site is as good as dead.


Ok, so you will be happy to learn that WCM (Web content management) sites that are created in SharePoint 2007 are pretty SEO-aware (Search Engine Optimization), and this comes a long way for you.


Some key features you enjoy with no hard work:


* Navigation, is configured OOTB (Out Of The Box) to reach all pages, expose them to the search bot / spider / what-you-might-call-it. All links are true a href links, no scripts.
* Zero to none use of hidden frames (only place you'll find them is in authoring mode
* Caching support and special attention for anonymous users (used by the search engines)


And much much more...



But - we are here to see what can we do to make it even better? How can I improve my site SEO?



Well, from a little research I did for a customer of mine while back we found 3 things that are actually can improve our SEO greatly.
(Important: I and not teaching how to cheat search engines! This is very dangerouse to play with. Simply how to make your site friendlier to search engines. You still have to have good content, incoming links and such to get good ratings on your site)



1: Turning off the view state.
2: Adding a site map for google.
3: Adding meta-tags for keywords and description for relevant content pages (advanced)

Ok, so let's go over these options and see what is the benefit and how it can be achieved:


Turning off the view state


What is gained?


If you right click->view source on any content page in MOSS you will see right at the beginning of the body tag you will see a input type hidden tag with id=__VIEWSTATE... then, its value will pretty much take your entire page so you'll have to scroll down several times...

So, apparently this gigantic piece of information is something that most search engines do not like to say the least. Especially when it comes before you true content of the page - it ruins your content rating in the search results!

Another obvious reason is, your page is larger... and larger pages are slower to load, and search engines will mark your page as a slower page... we don't want that.

How is it done?


Removing the view state from your WCM web application is rather easy. Simply go to your web application root directory (usually smth like: c:\inetpub\wwwroot\wss\xxxx),backup web.config file, and open it for edit in notepad. Look for enableViewState="true" and change it to false.

No need for IISRESET, but you site will experience a very small delay on the next request.

Adding a site map for google.

What is gained?

When a search engine (google in my example) starts indexing a web site it first of all checks to see if someone had prepared a "work order" for him. This "work-order" is what we call a sitemap / site map XML file that will allow us to make special requests for the crawler when it is working on our site.

If we do not have such a sitemap file, the engine will just open the home page of our web site and start crawling all links it can find on it for sub pages and so on and so forth...

This is usually good enough, except for cases where:

We want to have a section in our site that is not exposed by a link at the top site. Like http://www.kwizcom.com/ will not show a link to www.kwizcom.com/support (only example) which will hold our products support forum.

In this case - with no site map, our /support site will not be available at google at all.

Another problem we can prevent using a site map file is, when you have the same content in 3 different pages on your web site. 1 at the home page, and twice at the specific product information pages... Google will think you keep duplicate content and will lower your web site rank!

Using a sitemap, you can choose specifically what pages you want google to crawl, what pages are more important than others and what pages you don't want him to load.

One last benefit you gain by using a site map is that you can tell the engine what is the lifespan of each of your pages. Meaning: how often does its content change - monthly? weekly? so google will be sure to check it up every once in a while and update its content. Cool, eh?

How is it done?

Well, building a site map for MOSS (or any site for that matter) can of course be done manually, but you have to keep in mind that we are talking about a lot of pages to add to the XML files and this can be very time consuming!

Furthermore, you have to rebuild your site map every once in a while to reflect changes, additions and deletions...

You can develop a utility that does that for you, or use our site map builder here:

http://www.kwizcom.com/ProductPage.asp?ProductID=737&ProductSubNodeID=738

Once you got your hands on a site map generator, your work is just starting:

You will need to make changes in the XML to hide pages you don't want to show, change rating for more important pages and customize other information on it to match your requirements.

Adding meta-tags for keywords and description for relevant content pages (advanced)


What is gained?

By adding a meta tags of keywords and description to your pages you will let the search engine what content is your web site or web page targets.

This helps to raise the quality of the content in your web site. You may want to add specific keywords /description to all pages, and allow some pages to have additional information added to them.

How is it done?

Doing this can be very simple or very complex depends on your needs...

In the most simple straigh forward way - just edit your web site's master page and add the meta tags for keywords + description to the HTML head node like so:

<meta name="Description" content="KWizCom, knowledge worker components">

<meta name="Keywords" content="buy web parts, products, sharepoint, wss, moss">

But, if you requier your content to be changed according to the information of the current page (let's say you wish the page's title to go in to the description along with the site's name, and you have a metadata field named: keywords you wish to be loaded into the keywords tag), things get a little tricky.

But not to fear! I have created a control that will allow you to plant it in the master page and define what exactly you wish to see in these meta tags... it's just that using it is a bit tricky, so for now I don't have time to elaborate. But if you want it anyway before I manage to write a post about it - write me to shai at kwizcom.com and I will send it to you and try to help you configure it.



Ok, that concludes my post so far... it's been a very long while since I posted here, just in case you wondered - I relocated myself to Thornhill ON and didn't have enough time for nothing...

Hope this helps some of you,

Thanks,

Shai Petel

Sunday, January 20, 2008

Cache profile for WCM internet site

Hmmm… this took me a while to understand… but the solution is rather simple.

I wanted to activate cache profile for my customer WCM site, so that only anonymous users will see a shared cached version of the page.

Naturally – all anonymous users see the same version of the page and do not have editing rights nor can they see draft versions – so typically all you need to do is:
1: Go to site actions à site settings àsite collection administration à site collection output cache
2: Set the anonymous cache profile to “public internet (purely anonymous)
3: Click OK

And you are done.

But – I noticed there were no improvement in system-load (FE and DB servers) per requests and overall performance did not improve.

I went back to site collection output cache settings page and selected the “Enable debug cache information on pages” checkbox. Enabling this will append to the HTML a debug message stating when the current page was rendered and if cache was in use.

To my surprise (or not) I found this message:
"8 Output cache not used. Reason: User can view an unpublished version of the current page."

This meant that caching was not activated for anonymous users because they had access for unpublished version of current page? Not!

After contacting the WCM team, I got an interesting reply from Kai Lee (Thanks!) saying that this message will come up if the current user (anonymous in my case) have editing access or can view draft versions ANYWHERE IN THE SITE COLLECTION!

Well, I still have to check where anonymous users have this access in my site collection (worrying…) but there is (thank god!) a nice workaround.

Going into the “public internet” cache profile allows you to set "Allow Writers to view cached content" to “true”.

This is important to understand: for authenticated users, who can edit pages and suppose to view draft versions – this is BAD. But for my scenario – where I have no interest of allowing anonymous users to view these contents anyhow – it is a good workaround and what do you know?
It solved the problem!!!

So thanks Kai Lee again,

Hope this will save some time to the rest of you…

Thanks, Shai Petel.

Tuesday, December 11, 2007

Using InfoPath Forms Server with anonymous users

For so long I have been trying to convince my customers that the right combination of InfoPath, MOSS and workflow can solve 70% of their day to day business needs.

Well, guess what – I finally succeeded.

Only to learn that by default – forms server does not allow anonymous users to create new forms.

Well, my customer wanted to implement a “contact us” and “register to…” forms on his WCM MOSS internet site that will (of course) be published on the internet and allow any potential customer to fill in these forms with no need for logging in or registering for their site.

So, the solution for this consisted of 2 major steps.

Step 1 – defining out SharePoint site to use forms authentication provider.



I extended my AD web application (i.e. http://moss.kwizcom.com ) to a new web application (i.e. http://forms.kwizcom.com ) that uses forms authentication – this way I could create a simple user that has no privileges at all except to create items in the forms library (no edit / delete as well).

Step 2 – setting up a default logon user for anonymous users.



After step 1, all I had to do is to create a forms authentication user named: Internet User and give him write access to the forms library. Now, I added some code to auto login with that user when anyone browses to this web application http://forms.kwizcom.com.

For more information about completing step 1 you can see may blogs articles – simply google it.

I like Andrew connell’s one here: http://www.andrewconnell.com/blog/articles/HowToConfigPublishingSiteWithDualAuthProvidersAndAnonAccess.aspx

After you have forms authentication enabled on your second web application, the solution is rather easy.
  1. Create an InfoPath form, save it and publish it to a document library on your SharePoint server
  2. Create a new permission level on your site collection for “Add Only Read Only Permission”
    1. Go to Site Settings – top level site settings
    2. Click on advanced permissions
    3. On the “Settings” menu click on “Permission Levels”
    4. Add a new permission level named “Add Only Read Only Permission”
    5. Select only the “Add Items” check box (others will be auto selected – leave them)
    6. Click “Create”
  3. Create a new forms user named: Internet User
    1. Use the ASP.Net application to create a new user as explained in the Andrew Connell blog post above
  4. Give Internet User “Add Only Read Only” permission on the published form library
    1. Browse to the document library
    2. On the “Settings“ menu click “X Library Settings”
    3. Click on “permissions for this document library”
    4. If you don’t see the “new” menu item – you will have to break permissions for this library by clicking “Actions” and then “Edit Permissions”
    5. Click “New”, select Internet User give user permission directly to “Add Only Read Only Permission” permission level.
  5. Set up auto login for Internet User
    1. Go to the http://forms.kwizcom.com web root folder (by default: under c:\inetpub\wwwroot\wss\virtualdirectories\*
    2. Locate the global.asax file, back it up and open it in notepad
    3. Add this lines to the file to enable auto login as Internet User,
      replace [password] with the password you given the user.
      <script runat="server">
      public void FormsAuthentication_OnAuthenticate(object sender, FormsAuthenticationEventArgs args)
      {
      if (Membership.ValidateUser("Inernet User", "[password]"))
      {
      FormsAuthentication.SetAuthCookie("Inernet User", true);
      }
      }
      </script><.div>
    4. Save the file and close it.
Now we have to prepare the link for filling out this form using the browser.
To do so you will need a client PC that does not have InfoPath installed, browse to http://moss.kwizcom.com to the forms library, and click “New” on the forms library.
The forms server will open a browser based form for you to fill in.
Copy the URL of the create form page and replace http://moss.kwizcom.com with http://forms.kwizcom.com , replace moss with forms anywhere you see it in the query string as well, except for the “Source=” query string parameter.

That’s it! Simply put that URL at your site where you want users to create forms from and you are done!

Note: you might want to prevent user from browsing to http://forms.kwizcom.com and redirect them to the http://moss.kwizcom.com. This can be done in several ways. For demo purposes you could add this javascript to your master pages to make them do the redirect for you:

<script>
if(window.location.href.toLowerCase().slice(0,12) == “http://forms”)
window.location.href = window.location.href.toLowerCase().replace(“http://forms”, “http://moss”)
</script>

Wednesday, August 29, 2007

Manage Publishing Page Nodes in Site Navigation

Hi all,
What I am publishing here is some undocumented issues
involving navigation items in publishing enabled sites.

When you have publishing feature enabled in MOSS sites publishing
pages from “pages” library automatically set to be displayed in navigation. So far
– nothing is new.

What you didn’t know is that when you try to access these
items in the site’s navigation in order to perform a simple task such as hiding
a page from navigation, changing a page’s display order and other tasks
you are in to a nasty surprise!

What you want to do is to:

A: Get an instance of the current web site (SPWeb web = SPControl.GetContextWeb(Context) from within a web part.

B: Get the left navigation nodes collection (using web.Navigation.QuickLaunch)

C: Loop over navigation items and move/hide/rename etc… (foreach(SPNavigationNode node in web.Navigation.QuickLaunch))

But wait –

If you just created the site and added some pages to it you
are in to a nasty surprise as I promised. You will notice that
none of your
pages
that are displayed in the navigation are in that collection!

Actually the collection should be empty unless you added
some other items to it manually.

You will also notice a very weird behavior of
SharePoint that as soon as you open the “Navigation” page in the UI of
that site and make any change and save it – since that change all items
suddenly
appear in the navigation collection
as you expected them to from the
beginning!

My customer and I had to create pages and sites by code and
change their ordering by the same code. Of course we didn’t plan on browsing
each site and making a change manually – so we had to find a solution for that
issue.

The following code fixes that “problem”. It goes over a publishing
site pages library and make sure that all pages navigation nodes were created
and available for change using your code.

This took me quite a lot of time to investigate and find
this solution since it is not documented anywhere!!! So enjoy…

SPWeb curWeb = GetWeb();
PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(curWeb);
//Get existing links in navigation
//(so we know if to create new or move existing link)
List<string> existing = new List<string>();
foreach(SPNavigationNode node in curWeb.Navigation.QuickLaunch)
existing.Add(node.Url.ToLower());
//Loop for each page in pages library
foreach(SPListItem item in pWeb.PagesList.Items)
{
//Get a fresh copy of web – curWeb =
//new SPSite(curWeb.Site.ID).OpenWeb(curWeb.ID);...
curWeb = Utilities.Refresh(curWeb);

PublishingPage pp = PublishingPage.GetPublishingPage(item);
SPNavigationNode nn = null;
string ppUrl = pp.Uri.AbsolutePath.ToLower();
//check if exists in navigation
if (existing.Contains(ppUrl))
{
continue;
}
else//add a new navigation item
{
//not? add it.
nn = new SPNavigationNode(pp.Title, ppUrl);
nn = curWeb.Navigation.QuickLaunch.AddAsFirst(nn);
//here is the trick –
//We mark the navigation item as type “Page”.
nn.Properties["NodeType"] = "Page";
nn.Update();
}
curWeb.Update();
}

Wednesday, August 1, 2007

Variations Menu - switching between a page variations

Hi all,

I got to do quite a lot of work using MOSS WCM variations for creating translations of pages and sites to different languages.

Having the microsoft VM i noticed that whenever I created a new variation to a page a manu would show at the top right of the page and allow me to switch between all variations of that page.

To my (rather big) surprise I found out that when I did the very same procedure on my customer's production server variations did work ok and translated my pages but I did not see the variations menu and could not navigate from one variation of the page to another.

Looking at the master page I did see the variations menu control (<PublishingVariations:VariationsLabelMenu id="labelmenu1" runat="server"/>) was in place but it did not render any HMTL...

After some googling me and shlomy (my customer from IDC) did we learned that the variations menu control uses a user control (ascx file) to display the items, and that by default this control is commented out inside the ascx (?!?!?!?)

What I had to do in order to make the variations label menu visible is to open "VariationsLabelMenu.ascx" that is in "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\" and remove the comment text wrapping the control <%!-- and --%>

Now everything works!

Why is it turned off by default? Have no idea. But in 2-3 minutes you'll have your site's variations labe up and running and your users will be surfing between page translations in no time!

Hope this helps, will update if I find a reason to turn it off since I didnt find one yet.

Shai Ben Shooshan

Friday, June 15, 2007

Anonymous Users cannot access list views in MOSS Publishing sites

Hi All,

Again, I am posing you something I came across during a visit at one of my customers.

We are creating an internet portal based on MOSS Publishing WCM template. This portal is ment to be public and to allow anonymous users from the internet to view most of its contents.

But - as you may or may not know, anonymous users on WCM sites cannot view a list or library view pages, although they can browse directly to the document or list item when given the correct url. When trying to do so - they are prompted for user name and password... Also - and this is the main reason I had to look for a solution - when I added links to the documents into the current navigation of the site they did not appear for anonymous users.

After doing some investigation on the net I came across this KB #927082 on microsoft support site that explains this.

Apperantly all WCM sites are initialized with a special hidden feature that denies anonymous users from accessing dall and un-attactive SharePoint-like pages that does not fit a sexy-designed internet site.

This feature is called: "ViewFormPagesLockDown" and disabling it allows anonymous users to go around the site as I expected.

To disable this feature you must log on to the server and follow these steps:
1. Click Start, click Run, type cmd in the Open box, and then click OK.
2. Type the following lines at the command prompt. Press ENTER after each line.
cd /d %commonprogramfiles%\Microsoft Shared\Web Server Extensions\12\Bin
stsadm -o deactivatefeature -url http://ServerName -filename ViewFormPagesLockDown\feature.xml
3. Type exit to exit the command prompt.

After disabling this feature, you must turn anonymous access off and on again for changes to take effect.

Note: if you want it off only for one library or list like in my case, you can disable it, turn anonymous access on at that specific list and enable the feature again, leaving only that list opened for anonymous...