MUniversity of Minnesota

Tips and Tricks Archives


Tips and Tidbits
How do I put a search engine onto my blog?
How do I password protect my blog?
How do I display RSS feeds on my blog?
How do I show a list of my most recent comments?
How do I show a default number of posts on my blog home page?
How do I give a departmental Internet ID access to UThink?
How do I give the authors of a group blog anonymity when they post?
How do I add links to my blog home page?
What can I do with the Weblog Config section?
How do I change what my blog looks like?

October 05, 2006

Tips and Tidbits

First of all, let me say this is the most active semester UThink has ever had. Almost 1,000 active blogs and more posts every day than ever before. Success has its downsides, though, as the server has now become unacceptably slow at times. We are working on speeding things up so stay tuned for that information.

However, with all the new users and blogs I have some advice and tidbits you might find useful:

  • Don't use the "Extended Entry" -- I have found through statistical and anecdotal evidence that people rarely click on the extended entry link to read the rest of long entries. So, unless you are writing something so compelling that people won't be able to help themselves, keep the entire content of your post in the Entry Body. You have a better chance of it being read that way.

  • Google loves UThink: You may have already noticed this, but if you start blogging on UThink, a couple of weeks later your UThink blog will be very high on the Google search results screen when searching for your name (or maybe even a topic you've written about). Of course, this assumes that you have a unique name, but some people are rather stunned with this phenomenon. I don't have a definitive answer for why this happens, but it is probably because of the ".lib" in the domain name. Google is probably giving a higher page rank to UThink blogs because they come from a library. Anyway, this is both a benefit and a problem obviously, but on the bright side if you want to make a name for yourself, UThink may be a good place to do it.

  • Put a search engine on your blog -- Because Google does such a good job of indexing UThink blogs, it makes sense to use Google as a search engine for your blog content. If you are interested in having a search box on your blog that searches through all your old posts, follow these instructions:

    https://wiki.umn.edu/twiki/bin/view/UThink/SearchToolForBlogs

  • Save your posts periodically! -- If you are using UThink/Movable Type as a word processor of sorts to type out long, intelligent, compelling, and wonderful works of genius do yourself a favor and save your posts periodically! Movable Type has been known to lose these posts when a button is hit inadvertently, or if you accidently hit the back or foward button on your browser. When you are typing out a new entry, scroll down the page and find the "Post Status" section. It is set to "Published" by default, but you can also set it to "Unpublished" and, again, save your posts every once in a while as you are typing them. You can also use a word processor to type out a post and then copy and paste it into Movable Type. Whatever you choose to do, just do something so that you don't lose that wonderful post you are writing. For those of you that this has happened to, you know what I am talking about. Painful.

Stay tuned for more tips and tricks as the semester goes on. Also, for those of you concerned with the never ending battle against spam, we are plainning on installing the CAPTCHA Plugin. I'll keep you posted on that front. Talk to you all later!

Posted by snackeru at 02:43 PM

April 25, 2006

How do I put a search engine onto my blog?

Hello everyone! I'm still working on the technical FAQ, but in the meantime I thought I would give you some instructions on how to put a search engine on your blog. As many of you have already found out, the search tool that comes with Movable Type is woefully inadequate. In fact, it is just pathetic, especially when you are searching a database of the size that is UThink (as of 4/25/06 over 36,000 individual entries). It is for this reason that I have removed the search box from all new blogs and their corresponding templates. Searches were taking upwards of a minute to complete. Obviously, this is unacceptable.

There is an answer to our problem, however. Google actually does a very good job of indexing UThink content (a phenomenal job, truth be told) and it is possible to use Google to put a search box back on your blog. In fact, we can even use the U of M Google Search Appliance as our search engine, and you can even limit your search to the contents of your blog only. How do you do it?!?!? Well, just read on!

  1. Login to UThink and enter the blog you want to add a search box to.
  2. Click on "Templates" in the left hand menu and then click on the "Main Index" template.
  3. Look for the line that starts "<div id="beta">". It may be a little difficult to find, but it should be towards the middle of the template. When you find that line, add these lines right underneath it:

    <div id="beta-inner" class="pkg">
    <div class="module-search module">
    <h2 class="module-header">Search</h2>
    <div class="module-content">
    <form method="get" action="http://www.google.com/u/umn">
    <input id="search" name="q" size="20" /><br />
    <input type="hidden" name="domains" value="<$MTBlogURL$>" />
    <input type="hidden" name="sitesearch" value="<$MTBlogURL$>" />
    <input type="submit" value="Search" />
    </div>
    </div>

Save the template and rebuild it. Then try a search. It should be able to find entries that have been indexed by the U of M Google Search Appliance. Of course, it will not be able to find entries that you have just written, but that should be OK since those entries are probably still on your blog home page.

Give it a try and let me know what you think. If this works well I may just put this in the default templates for all new blogs. Happy searching!

(PS -- These instructions apply to blogs created with MT 3.2 templates (all new blogs). If you have a blog older than November 2005, I can provide you with alternate instructions. Just let me know!)

Posted by snackeru at 03:00 PM | Comments (2)

December 09, 2005

How do I password protect my blog?

Of all the suggestions I receive for desired features on UThink, by far the number one suggestion is the ability to password protect your blog. Well, thanks to the upgrade, this is now possible. However, before we begin I must warn you that for some this will not be easy. Some of you will find these instrutions to be the equivalent of ancient Greek. I will try to do my best to make them as easy to understand as possible. One more thing, these instructions are for PC users only. They may work for the Mac, but I cannot guarantee it. Please let me know if you can get this to work for the Mac platform.

While it would be nice if Movable Type had password protection capabilities built in to its interface, the fact of the matter is it doesn't. So we have to work around that. What we'll be using is the Apache web server's built in capability to password protect a directory. In order to password protect the directory that your blog sits in you must create two files: a ".htaccess" file and a ".htpasswd" file. And yes, you read that correctly, each file name begins with a dot (".").

The trouble with these two files is that you cannot create them with Word or Notepad. You must use a text editor that strips out all the extra encoding stuff that Microsoft wants to put into a file. You may be able to use an HTML editor that you already have on your computer, or you can try to download a free/trial version of a Notepad replacement. I would recommend either EditPad Lite or the free Notepad++. If you aren't sure of what to do, just download Notepad++ and carry on with the instructions below.

With your text editor, create a new file. This will be the ".htaccess" file. It should have the following text:

AuthUserFile /htdocs/blog/[your Internet ID]/[your blog directory name]/.htpasswd
AuthName "You gotta log in"
AuthType Basic
Allow from all
Require valid-user

Replace the parts that say [your Internet ID] and [your blog directory name] with your Internet ID and the name of the directory right after your Internet ID in your blog's URL. (You may also want to replace the text "You gotta log in"!) For example, my test blog has the URL: http://blog.lib.umn.edu/snackeru/test/. So, I would create an .htaccess file that looks like this:

AuthUserFile /htdocs/blog/snackeru/test/.htpasswd
AuthName "You gotta log in"
AuthType Basic
Allow from all
Require valid-user

Save this file somewhere on your computer where you'll be able to find it again, like your desktop. We will be uploading this file to your blog later.

Now we need to create your ".htpasswd" file. You'll note that this file is referred to in the .htaccess file above. The first thing you'll need to do for this file, though, is generate a username and password. For this task, we will need to use an htaccess password generator because this method requires that your password is encoded into something unrecognizable. Confused? Don't worry about it, just use the htaccess password generator to pick a username and password and follow the instructions below.

Let's say I want to create a username of "goldy" and a password of "gopher." Using the htaccess password generator I might get a line of text that looks like this:

goldy:I2ZU0L1SBgrMw

Take your line and in your text editor create a new file and paste that line in. Save your file as ".htpasswd" in the same place as you saved your .htaccess file.

Still with me? You should have two files, a .htaccess file and a .htpasswd file. Now we will upload them to your blog directory. Login to UThink and enter the blog that you want to password protect. Click on "Upload File" in the left hand menu and one at a time upload your two files:

Upload files

Since you aren't creating a new entry or a link with these new files, just exit out of the next screen. Once you have them both uploaded, go to your blog home page and test it out.

If you would like to see how this works, check out my test blog snackeru playground. Use the username/password "goldy/gopher." Let me know if you have any difficulty.

Now, there is a pretty good chance that you will have difficulty with this or that after you get it to work you may at some point want to take your password protection away (or change your password). In that case, you may want to delete the your .htaccess and .htpasswd files. To delete files on your blog (and view all the files in your blog directory) use the "List Blog Files" tool located in the left hand menu of Movable Type. You may delete files one at a time, or multiple files at once.

Anyway, that is how you add password protection to your blogs, at least for the immediate future. As new plugins are developed for Movable Type we will hopefully be making this process easier. Until then, let me know if this works for you!

UPDATE 3/3/2006: It is also recommended that you alter your RSS 2.0 template if you use the above method to password protect your blog. The RSS 2.0 template has a command that looks for various media you may be uploading to your blog, and the directory level password protection can sometimes cause an error to this function.

To fix this, login into UThink, click on Templates, and then click on the RSS 2.0 template. Find the line that says:

<$MTEntryEnclosures$>

Take it out and rebuild. What this tag basically does is allow for podcasts. If you are password protecting the directory, you have taken away the capability to podcast from your blog anyway.

Posted by snackeru at 10:22 AM | Comments (3)

January 07, 2005

How do I display RSS feeds on my blog?

A couple of entries ago I wrote about RSS feeds and how to make use of the RSS feeds on UThink. Now I'd like to turn our attention to RSS feeds outside of UThink and how to make use of them on your own blog. Many people have asked me if it is possible to display RSS feeds from other blogs outside of our system on their own blog home page(s). In the past, the answer has been no due to a limitation of how we originally set up the UThink server. Now however, thanks to the server upgrades alluded to in a previous post, it is possible to present RSS (or Atom) feeds from any blog or news service that provides them. Allow me to explain how.

When we upgraded the UThink server we cleaned up our installation of PHP and made it more functional and secure. What is PHP? In a nutshell, PHP is a programming language that can help you make your blog more dynamic. Using PHP and the "lastRSS.php" script I spoke about on December 10 you can put RSS based content onto your blog home page, or another page on your blog, that updates every time the RSS feed has new content to display. Sound cool? Let's give it a try then.

Since this is somewhat of an advanced skill, it is strongly recommended that you create a test blog to try this out on. If you are new to programming, or new to PHP, do not try this on your main blog until you are confident that you know what you are doing.

The first step you will need to perform is to change the name of your blog home page from "index.html" to "index.phtml." Why? Because by naming your "index" file with a ".phtml" extension you are telling the server that there will be some PHP on this file that the server will need to parse through. So:

  1. Log into UThink and select the blog you would like to test this out on.
  2. In the left hand menu of the administrative interface, click on Templates.
  3. Click on the "Main Index" template.
  4. In the "Output File" box, enter the text "index.phtml."
  5. Click on "Save".

What this will do is change your home page's main file into "index.phtml" rather than "index.html". Have no fear! This will not change the URL of your blog. Your URL will still be http://blog.lib.umn.edu/internetid/blogname/ .

Now we will enter the necessary PHP. At the top of the Main Index file, on top of all the other code, enter this snippet:



<?php

// include lastRSS
include "lastRSS.php";

// Create lastRSS object
$rss = new lastRSS;

// Set cache dir and cache time limit (1200 seconds)
// This will dictate how long the program should wait before it attempts to
// retrieve the RSS feed again.
$rss->cache_dir = '.';
$rss->cache_time = 1200;

?>



As you can see, this snippet of code makes use of the "lastRSS.php" program that will do the heavy lifting of going out and retrieving the content of the RSS feed you specify. Now, all you need to do is pick the feed you'd like to show and pick a place on your blog home page to show that feed. For the sake of this demonstration, I am going to use the "Top Stories" RSS feed from Yahoo! News. That feed can be found at http://rss.news.yahoo.com/rss/topstories. Now where should we put it. I would recommend somewhere in your sidebar underneath your calendar and links for your recent entries. Of course, you can pick where ever you want. If you pick the side bar, create a section for the feed and then enter this snippet of code:


<?php
// Try to load and parse RSS file
if ($rs = $rss->get('http://rss.news.yahoo.com/rss/topstories')) {
// Show website logo (if presented)
if ($rs[image_url] != '') {
echo "<a href=\"$rs[image_link]\"><img src=\"$rs[image_url]\" alt=\"$rs[image_title]\" vspace=\"1\" border=\"0\" /></a><br />\n";
}
// Show clickable website title
echo "<center><a href=\"$rs[link]\">$rs[title]</a></center><br />\n";
// Show website description
echo "$rs[description]<br />\n";
// Show last published articles (title, link, description)

echo "<ul>\n";
$num = 1;
foreach($rs['items'] as $item) {
if ($num <= 10) {
echo "\t<li><a href=\"$item[link]\">".$item['title']."</a><br />".$item['description']."</li>\n";
$num++;
}
}
echo "</ul>\n";
}
else {
echo "Error: It's not possible to reach RSS file...\n";
}

?>



Note the line "($rs = $rss->get('http://rss.news.yahoo.com/rss/topstories'))." Hopefully you have figured out that this is where you can put your own RSS feeds, or other feeds you or your readers may be interested in. Once you have entered the code snippet above, click "Save" within the administration interface of MT, and then "Rebuild." When it is finished, look at your blog home page to make sure everything looks good. If you'd like to see an example of what this shold look like, check out my test blog snackeru playground and look at the sidebar to the right. If you see a blank screen after you try this out it means that you have done something wrong with the PHP code. Go back, look for your errors, and try it again. Welcome to the world of programming!

Check out the lastRSS web site for more ways to render RSS feeds through PHP. If you have any questions, feel free to leave a comment!

Posted by snackeru at 01:29 PM

October 01, 2004

How do I show a list of my most recent comments?

Did you know that you can show a list of the most recent comments to your blog. In that way, you can demonstrate to a new reader what entries have received the most discussion on your blog. It is actually very simple to do:

  1. First log into UThink.
  2. Click on the blog you'd like to create a list of the most recent comments for.
  3. Click on "Templates," and then on the "Main Index Template."
  4. Find the code in the Main Index Template that prints out the Search box.

    If you have created your blog after November 28, 2005, add the following code:

    <h2 class="module-header">Recent Comments</h2>
    <div class="module-categories module">
    <div class="module-content">
    <MTEntries recently_commented_on="7" sort_order="descend">
    <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> (<$MTEntryCommentCount$>)<br /><MTComments lastn="1">
    <$MTCommentAuthorLink spam_protect="1"$> wrote:
    <$MTCommentBody trim_to="50" remove_html="1" convert_breaks="0"$>...[<a href="<$MTEntryLink$>#<$MTCommentID$>">more</a>]<br /><br /></MTComments>
    </MTEntries>
    </div>
    </div>

    If you have an older blog, right under the search box, add this code:

    <div class="sidetitle">
    Recent Comments
    </div>

    <div class="side">
    <MTEntries recently_commented_on="7" sort_order="descend">
    <a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> (<$MTEntryCommentCount$>)<br /><MTComments lastn="1">
    <$MTCommentAuthorLink spam_protect="1"$> wrote:
    <$MTCommentBody trim_to="50" remove_html="1"
    convert_breaks="0"$>...[<a href="<$MTEntryLink$>#<$MTCommentID$>">more</a>]<br /><br /></MTComments>
    </MTEntries>
    </div>

  5. Click on "Save" and then "Rebuild" and you should now see your most recent comments in your side menu section.

Give is a try and let me know how it works for you!
Posted by snackeru at 03:09 PM

September 24, 2004

How do I show a default number of posts on my blog home page?

Movable Type is automatically set up to display 7 days of posts. Many times, however, seven days isn't enough, especially if you don't post everyday or if you only post once a week. Within the WebLog Config section of the administration interface there is a way to increase the number of days you want to show on your blog's home page, among other options. There is also another option. There is a way you can set up your blog home page to always show a default number of posts rather than a set number of days. Using this method, you could set your blog to always show your last 10 posts, or 20 posts, or however many you want.

To make this work you must alter the Main Index Template in the Templates section of the MT administrative interface. Once you are in the Main Index Template find this line:

<MTEntries>

alter it to look like this:

<MTEntries lastn="10">

Of course, you can enter any number into the "lastn" variable that you desire. After you have altered the line click "Save" and then "Rebuild." Your blog home page should now always show your last 10 (or whatever) entries.

Posted by snackeru at 11:40 AM

September 02, 2004

How do I give a departmental Internet ID access to UThink?

I've gotten a fair number of emails concerning this topic so I thought I should write more about it: How do you give departmental Internet IDs or email addresses access to UThink? First of all, there is a good reason why you might want to do this. If you've used UThink before you'll note that the initial directory given to your blog is always your Internet ID. If you can login to UThink with a departmental Internet ID, though, the initial directory would be the department's Internet ID.

However, If you've tried to log into UThink using a departmental Internet ID you've probably noticed that you are denied access. The University Libraries have a unique method of accessing Internet ID credentials through the Central Authentication Hub. Essentially, when a person tries to login to any library database, index, or system we check to make sure that person has the proper "library flags" in his or her x.500 record. Unfortunately, departmental Internet IDs are not given any library flags.

There is a way to get around this. All you need to do is attach your departmental Internet ID to an existing blog, and then retry logging in using that departmental Internet ID. Here are some step by step instructions:

  1. Log into UThink using your own Internet ID and password.
  2. If you haven't done so already, create a blog.
  3. Return to the main Menu of Movable Type (link at the top of the page) and click on "Authors" under "System Shortcuts."
  4. Enter your departmental Internet ID under "Create an Author" and check a blog to attach it to.
  5. Click "Save" and logout of the system (this is important since you have to clear your personal Internet ID's credentials).
  6. Log back into UThink, but this time use your departmental Internet ID and password.
  7. Once you are in "Create a New Blog" and your department's Internet ID will be the first directory.

As you might have already guessed, this method will work for any Internet ID, including Internet IDs from U of M coordinate campuses. So, give it a try and let me know if you run into any problems!

Posted by snackeru at 02:27 PM

August 13, 2004

How do I give the authors of a group blog anonymity when they post?

In order to give the authors of a group blog some anonymity you will need to modify your "Template" files. Your students will also need to give themselves a "nickname" in the "Edit Your Profile" section of the blog administration pages (off of the Main Menu). For example, to display the student's chosen nickname rather than his/her Internet ID on the blog home page, in the Main Index Template find the section that starts:

" <div class="posted">Posted by <$MTEntryAuthor$> at "

Replace this in the Main Index Template with:

" <div class="posted">Posted by
<MTIfNonEmpty tag="MTEntryAuthorNickname">
<$MTEntryAuthorNickname$>
</MTIfNonEmpty>
<MTIfEmpty var="EntryAuthorNickname">
<$MTEntryAuthor$>
</MTIfEmpty> at "

Of course, this will only change the Main Index. If you want to give your students anonymity throughout the whole site, this process will have to be repeated on the Category Template, the Individual Entry Template, and the Date based Template.

Posted by snackeru at 04:18 PM | Comments (6)

August 12, 2004

How do I add links to my blog home page?

One thing I've noticed from a lot of new blog users is that they haven't added any links to the "Links" section of the home pages on their blogs. This section comes automatically in a new UThink blog and it is there to hold the links to all of your favorite websites, blogs and otherwise. If you would like to know how to add links to your UThink home page then this is the post for you.

First of all, log into your UThink blog. Select the blog you would like to put links on, and then select "Templates" in the left hand navigation menu of the administration screen. Now select the "Main Index" template. This is essentially the code for your blog home page. For those of you that don't know any HTML, or MT specific codes, this page can look a little daunting. Have no fear! If you make a big mistake you can always download the Main Index default template from the UThink site and start from scratch.

On the Main Index template scroll down the Template Body until you find a section that says:

<div class="side">
<a href="">Add Your Links Here</a><br />
</div>

This is where you will put your links. This section of code is located towards the bottom of the Template Body so just scroll down all the way and then scroll back up a tiny bit. You should see it there. Now add your links like this:

<div class="side">
<a href="http://blog.lib.umn.edu/">UThink: Blogs at the University Libraries</a><br />
<a href="http://www.lib.umn.edu/">University Libraries Home Page</a><br />
<a href="http://www.umn.edu">University of Minnesota Home Page</a><br />
</div>

Add as many links as you want. Of course, you can substitute these links with your favorite links on your own blog. Once you've added all of your links, click "Save" and then "Rebuild" and rebuild the Main Index (or "All Files"). Click "View Site" and take a look at your new home page, now with your favorite websites in the "Links" section. If you don't see anything, try to "Refresh" or "Reload" your blog home page in your browser.

Let me know if you have any comments or questions!

Posted by snackeru at 01:25 PM

August 04, 2004

What can I do with the Weblog Config section?

In the coming weeks I hope to write little tutorials or tips about UThink in a new category called "Tips and Tricks." The first post in this category will focus on the Weblog Config section of your blog within Movable Type. If you haven't ventured into this section of your blog's administration interface, you may want to check it out. Inside of "Preferences" you can:


  • Enter the number of days' entries you would like displayed on your index.
    What this will do is change the number of days you display on your blog's home page. The default is 7 days worth of entries. If you are one of the many bloggers who don't post every day, you may want to consider increasing the number of days to display on your blog's home page. That way your you can set up your home page to always have content on it mirroring how often you actually update your blog.

  • Select whether you want your posts displayed in ascending (oldest at top) or descending (newest at top) order.
    Pretty self explanatory, but useful if you are creating an atypical blog.

  • Select a Creative Commons license for the posts on your blog (optional).
    If you select a license, the index page of your weblog will automatically be updated to include information about the license you have chosen, and the same metadata will be added to your RSS 1.0 feed in machine-readable format.

  • Would you liked to be notified via email when someone posts comments to your site?
    Check "Email new comments" and receive an email every time someone leaves a comment on your site!


These are just a few of the options to choose from when configuring the Weblog Config Preferences of your UThink blog. To access the Weblog Config of your blog simply login to UThink, choose a blog you have access to, click on WebLog Config in the left hand menu, and then Preferences at the top of the screen.

Stay tuned for more tips and tricks!

Posted by snackeru at 03:26 PM

May 24, 2004

How do I change what my blog looks like?

I have written a new "Templates" page to give people that would like to change the appearance of their weblog(s) a better idea of how to do so. Essentially, the easiest way to change the layout and colors of your site is to change the Stylesheet of your blog. Thanks to styles available from Movable Style, UThink now offers 10 distinct styles ready for you to plug into your blog:

  • Clean
  • Trendy
  • Georgia
  • Gettysburg
  • Rusty
  • Plain Jane
  • Typepad Thin
  • Plain Blue
  • Mac Stripe
  • Matrix Code
  • Simply follow the instructions at the top of the Templates page to implement one of these styles, or visit Movable Style for more choices.

    You may also be wondering why the UThink default template is so dull or why it doesn't contain the U of M wordmark or the block "M." University policy prohibits these symbols of the University from appearing on web pages that are personal in nature. Obviously blogs can be very personal!

    Finally, if you have any skill with CSS and/or HTML please consider using that skill to create new templates for UThink! If you have a style you'd like to share, or if you are thinking about creating a new style for the UThink system, please email uthink@umn.edu.

    Posted by snackeru at 04:04 PM