A Blog by Scott Isaacs

Tag: Community Server

Google Search Results In Community Server 2007

I was having issues with the built-in search in CS2007.  Basically it was loading a blank page (no HTML at all) instead of the search results page.  I’m sure I could find some info about the issue in the forums, but decided I would take a few minutes to try to implement Google’s Custom Search instead.  I spent more time futzing with the CS files than necessary to figure it out, but in the end the changes were pretty simple.

Step 1: First, sign up on Google to have a custom search engine.  I’m not going to walk through this since it’s not that hard, and I’m sure you’re smart.  After your site is setup, go to the Code link in the control panel.  Expand the “Search box and search results code for your website” panel.  I recommend using the watermark text box because it will most likely match your site better than the other options.

Step 2: Backup these two files: /Themes/Blogs/YOURTHEME/theme.master and /Themes/Blogs/YOURTHEME/search.aspx.

Step 3: Open /Themes/Blogs/YOURTHEME/theme.master and remove the section for <CSBlog:SearchForm … />.  Replace that with code similar to the following, with variables changed based on what you get from Google:

<div id=”Search” align=”right”>  <table cellpadding=”0″ cellspacing=”0″ border=”0″>    <tr><td>      <input name=”q” id=”q” type=”text” class=”searchBox” 
Button=”SearchButton” onkeydown=”javascript:if((event.which
&& event.which == 13) || (event.keyCode
&& event.keyCode
== 13)) {GoogleSearch();return false;}else return true;”
/> </td><td> <span class=”SearchButtonOuter”> <a id=”ctl00_ctl06_ctl00_SearchButton” class=”SearchButton”
href=”javascript:GoogleSearch2();”>Search</a> </span> </td></tr> </table> </div><script language=”JavaScript”>function GoogleSearch2(){window.location =
“http://www.tapmymind.com/blog/tap_my_mind/search.aspx” +“?q=” + document.getElementById(“q”).value +“&cx=014327199496625865409:3nxxz5mvxtw” +“&cof=FORID:10” +“&sa=search”;}function GoogleSearch() { window.setTimeout(“GoogleSearch2()”, 200);}</script><script type=”text/javascript”
src=”http://google.com/coop/cse/brand?form=aspnetForm”></script>

You may have to change some HTML for layout purposes.  I am using the Paperclip theme and this worked for me.  I basically copied the resulting HTML from a source view of the unmodified page, inserting stuff where I thought was appropriate.

Also, the setTimeout was to cause a delay before submitting the form with the Enter key (the whole bit about event.keyCode, etc.) due to some issues I found with IE’s autocomplete not, ummm, completing before the form was submitted.  Also note that I am using the current search URL.

Step 4: Open /Themes/Blogs/YOURTHEME/theme.master and remove then contents of the <asp:Content … /> item — just the contents, leave the asp:Content element itself.  In it’s place add code like this (again, based on what Google gives you):

<h2 class=”pageTitle”>Google Custom Search Results</h2>These results are coming directly from Google’s search engine.  
Consequently, some items do not show up in the results right
away. If you are search for a post you expected to find, but
it is not listed, please try the same search on <a href=”http://blogsearch.google.com/blogsearch?as_q=<%
Response.Write(Server.UrlEncode(Request.QueryString[“q”]));
%>&bl_url=tapmymind.com”>
Google’s Blog Search tool</a>.<br /><br /><!– Google Search Result Snippet Begins –><div id=”results_014327199496625865409:3nxxz5mvxtw”></div><script type=”text/javascript”> var googleSearchIframeName =
“results_014327199496625865409:3nxxz5mvxtw”; var googleSearchFormName = “aspnetForm”; var googleSearchFrameWidth = 500; var googleSearchFrameborder = 0; var googleSearchDomain = “google.com”; var googleSearchPath = “/cse”;</script><script type=”text/javascript”
src=”http://www.google.com/afsonline/show_afs_search.js”></script><!– Google Search Result Snippet Ends –>

Note that I specified the search form name as “aspnetForm” (here as well as in the previous step).  This is the name/id the resulting HTML form has and correctly specifying this allows Google to properly add the watermark, as well as pre-populate the text box with the current search term automatically.

I also added a link to do the same search on Google’s Blog Search (GBS) tool.  I noticed that a post I recently added was not showing in the results because it hadn’t been indexed yet (I assume), but it does show in GBS because of pings that CS2007 sends for me.  So I coded the link to automatically search my site (you’ll want to change the value for bl_url) and the current search term.

Step 5: This step may or may not be important to you, but I also had to modify styles.css for the current theme so that the text box was wide enough to show the Google watermark.  I don’t have that file handy at the moment, but I think I changed the width to 140 or 150px.

As far as I can remember, that’s all I did, and so far it works for me.  I imagine many other people have already tried this and figured it out, but I didn’t bother searching for examples.  I didn’t really test this heavily, so please let me know if you find bugs or have suggestions.  I just have to remember this if I change themes or upgrade CS (hence this post).

Be sure to be aware of wrapping issues with the code I have posted here.  Also, I strongly recommend you backup everything you are going to edit first.  I’m not responsible for any damage you cause to your site.  [:)]

If anyone has an easier way, let me know.

Community Server Theming Contests

As you may or may not know, I use Telligent’s Community Server as a blog engine here, as well as for photos and forums elsewhere.  Well, they are having a Theme Extravaganza — a contest for making custom themes.  Prizes include MacBooks, XBox 360s and Amazon gift cards.

Dan Bartels, a Milwaukee area local, works for Telligent, and he contacted me the other day with this offer:

While I cannot enter the “public contest” I’d be willing to give some help to some folks to get them started, point them in the right direction, ect… So please extend this offer to anyone you see fit.

Further, we are having in “internal” contest; here is where I could use some help… I could use some PSD’s and or artwork from a community member (I will give them full credit and linkage for the design)…

If you’re interested, please contact Dan, either via his website or by e-mailing him at dbartels AT telligent DOT com.

Good luck!

New RSS Feed Address

If you subscribe to my feed in RSS, you may be interested to know that the address has change to http://feeds.feedburner.com/tapmymind.  From what I can tell, if your RSS reader supports redirects (which I imagine most do these days), you shouldn’t have to change anything.  If not, however, you will need to switch to the new address.

I decided to try FeedBurner because they offer various statistics that might not otherwise be available.  Plus, all the cool kids are doing it.  [:)]

Community Server 2007 and Windows Live Writer

So I just upgraded to Community Server 2007 today, and I’ve been using Windows Live Writer for my last couple posts.  This is my first test of the two in combination. 

One thing to note, in WLW I tried to update the style of my blog, but it failed for some reason.  I may look into it later, but in all reality it’s not that important for me to see my posts in the same exact layout as they will appear after publishing.  Also, I still want to update the skin from the default one being used, but I’m not sure when I’ll get around to that.

One gripe I having about using WLW is that adding categories (tags), while easy enough to do, is obscure enough to make it easy to forget.  It’s not really obscure, just not front and center.  Oh, well.  I imagine it will just take a little time to get used to it.

Update: For some reason, after I restarted WLW a few times, the “Update Weblog Style” function began working.  Also, be sure to remember (like I didn’t) that by default CS removes the www from your URL, and that was causing problems with WLW finding the MetaBlog API (since I had changed that on my previous CS install and hadn’t changed it again on the new version).

More on CS 2.0

OK, so I’ve tweaked the blog skin a little (added a couple things to the side bar), and I’m getting used to it.  I also downloaded this from the CS site.  It lets me type code into my posts and it highlights it for me.  For example:

[code language=”VB.NET”]’ VB
Dim myString as String = “Hello world”[/code]

[code language=”C#”]// C#
string myString = “Hello world”;[/code]

[code language=”T-SQL”]– SQL
select ‘Hello world'[/code]

[code language=”ASP/ASP.NET”]<%’ ASP.NET %>
<asp:Label id=”Label1″ runat=”server” />[/code]

I don’t post a lot of code really, but maybe now I will… [;)]

Newsletter Sender

OK, so that’s a really lame name for a program, but I named it so I wouldn’t forget what it was.  I could have called it PhireFaacs, but really, do you think I would know what that was in two weeks?  Forget for a moment how much ridicule I would receive from my peers for choosing such a stupid name — that’s an even dumber name than “Newsletter Sender”.

Anyway, I wrote a simple little WinForms program last night (screenshots below) to help me send out the newsletter for the WI .NET Users Group.  (See how I decided on the name???)  In a nutshell it does a mail merge of some comma delimeted text datasource against an e-mail template.  “So what?”, you ask.  Yeah, I asked that, too, but it does make my newsletter sending a little easier.

Basic instructions (because there is no help file or tooltips):

  • Specify an SMTP mail server, and optional SMTP username and password.
  • Load a data file.  This can be any CSV formatted file, but there must be row headers.
  • Specify which field in the data file contains e-mail addresses.
  • Enter the “from” address.
  • Enter the message subject.
  • Enter the message body.
  • Specify a priority.
  • Click “Send”

The SMTP mail server, SMTP username, and from address can be stored in an XML file that gets created the first time you run the program (you have to edit it manually).  The subject and body can contain placeholders ({0}, {1}, etc.) that will be replaced with data from that column (note that this is zero-based index).

That’s basically it.

The ZIP download is available here.  Blah blah blah your own risk blah blah blah I’m not responsible blah blah blah.

Screenshots (also included in ZIP download)

The UI:

A Merged E-mail:

Ditching Google AdSense

So the Google AdSense thing wasn’t working for me, and I’m not referring to the fact that I only made 60 cents.  OK, so maybe it has a little to do with that, but the real reason is that the ads were totally out of context.  99% of the ads that were displayed were about “blog”.  The other 1% was about tsunami relief.

Both, I’m sure, are fine topics, but are not relevant to my content like they “were supposed to be”.  I e-mailed Google about this a few times to find out what could be done.  My third e-mail got no response at all.  The two responses before that were (paraphrased):

  • I need to wait for indexing by the AdSense crawler.
  • I need to use full sentences and paragraphs about specific topics.

OK, the first one I could understand.  I didn’t realize at first that AdSense uses a different index than the regular Google index. 

The second suggestion, though, was a little frustrating, for a couple reasons.  First, I know I’m not a hardcore tech writer, where all I write about is code, but the majority of my posts were, in some way, about technology and development.  Second, I’m not writing term papers or essays, and in most cases, long paragraphs don’t “make sense”.  Also, as far as I can tell, I nearly always use compelte sentences.

In addition to describing my above reasoning, in each of my three e-mails, I asked (or suggested) if there was a way to “tag” my content.  For example, I could surround my content with something like this:

<div rel=”adsensecontent”>…</div>

Well, my third e-mail has been unanswered for 10 days now, so today I decided to ditch Google AdSense.  It’s not that I expect them to change their technology based on my suggestion, but I suggested/asked about something like that in each of the three e-mails, and that part was ignored each time.  It wasn’t working for me, maybe it will for you.  I’m not the only one, though.  Julie Lerman blogged about a similar issue.

Anyway, in place of AdSense, I’ve decided to post jobs from karmaONE, a service for referring people to open positions.  You can read all about it here on their site.  The service is currently in BETA, and, as you can see, most of the jobs are currently located in the San Francisco area.  If you are a recruiter in the Wisconsin area, check out karmaONE — you can help to make this list more relevant.  I might end up getting some money, but you’ll end up with a good candidate.

In the end, though, as much as I’d like extra money for doing pratcially nothing, I decided that I’d rather my “practically nothing” at least possibly help someone find a job.

For those that care, I’m actually using OpenGUI’s Feed2JS service to display these links.  What can I say — I’m too lazy to write my own RSS display module for CommunityServer.

Comments Have Been Restored

Well, after being down for about a week, comments are now re-enabled on my blog.

I posted to the CS Forums about this issue to try to get some help, but no one ever responded.  So I decided to ask someone I know that works for TelligentDan Bartels.  I sent Dan a short e-mail, pointing to my forum question, and he responded right away (within ~30 minutes).

He made a simple suggestion to temporarily switch to the default blog skin and see if comments would work.  The comments did work!  My problem stemmed from the fact that I was using a customized version of a skin that came in the 1.0x CS distribution.  Based on his suggestion, when I got home I poked around for about 10 minutes and got it working.  In case anyone else has a similar problem, here is my simple solution.

In the /Themes/Blogs/_Your_Theme_/Skin-EntryPostCommentContainer.ascx, add this line:

<Blog:EntryComments runat = “Server” ID =”comments” />

For example, my file now looks like this:

<%@ Control Language=”C#” %>
<%@ Register TagPrefix=”Blog” Namespace=”CommunityServer.Blogs.Controls” Assembly=”CommunityServer.Blogs” %>
<%@ Import Namespace=”CommunityServer.Components” %>

<Blog:EntryView runat = “Server” ID = “Entry” />
<Blog:EntryComments runat = “Server” ID =”comments” />
<Blog:CommentForm runat = “Server” ID =”form” />

You could also just copy this file from /Themes/Blogs/default/, but you would lose any other changes you may have done to the file.

Thanks for the tip, Dan!!

Powered by WordPress & Theme by Anders Norén