Related Stories Widget

download related stories widget

The Altweeklies.com Related Stories Widget is for use on website story pages to refer readers to related stories catalogued on Altweeklies.com. The results provided by this widget are more targeted than the links provided by the Teaser widget, which can only return results based on the section or category. Additionally, this widget will by default only show itself if there are results and does not hold up the loading of the page in the unlikely event Altweeklies.com is unresponsive to the browser.

See the following links for some examples of this widget in the wild.

Basic Setup

Assuming you are using the rel="tag" microformat on your story pages, the include script will automatically pick up the tags for the page and use them to query Altweeklies.com. You can also manually pass the tags to the include if you are not using this microformat, see the function reference below.

First, upload the included altweeklies-include.js file to your webserver and make sure it is loaded by every page on your site that you wish to do the include on. For simplicity you may just want to have it load in right before the widget.

<script type="text/javascript" 
      src="/scripts/altweeklies-include.js"></script>

Then place the following code on the page where you'd like to place the widget.

<div class="altweekliesRelatedStories" style="display:none">
  <h3>
    Related Stories From
    <a href="http://www.altweeklies.com/">Altweeklies.com</a>
  </h3>
  <div id="AltweekliesInclude"></div>
</div>
<script type="text/javascript"><!--
  altweekliesInclude({"id": "AltweekliesInclude", "max": 3});
//--></script>

You'll also need to apply appropriate styles to the results returned by the include. Here's an example style sheet that works with the above code.

  /* Altweeklies Related Stories Reset Styles */
  .altweekliesRelatedStories ul, .altweekliesRelatedStories li,
  .altweekliesRelatedStories h3, .altweekliesRelatedStories h4,
  .altweekliesRelatedStories h5 {
      margin: 0; padding: 0;
      font-size: 100%; font-weight: normal;
  }
  .altweekliesRelatedStories li {
      list-style: none;
  }

  /* Altweeklies Related Stories */
  .altweekliesRelatedStories {
      font-family: Arial, sans-serif;
      font-size: 12px;
  }
  .altweekliesRelatedStories h3 {
      font-size: 16px;
      font-weight: normal;
      margin: 0 0 5px 0;
      padding: 0;
      border-bottom: 1px solid black;
  }
  .altweekliesRelatedStories li.l0 {
      margin-bottom: 10px;
  }
  .altweekliesRelatedStories h4 {
      font-size: 12px;
      margin: 0 0 5px 0;
  }
  .altweekliesRelatedStories h5 {
      font-weight: normal;
      font-size: 12px;
  }
  .altweekliesRelatedStories .byline {
      font-style: italic;
  }

And here's a live example of the include, using the tag .

Function Reference

The altweekliesInclude() Javascript function is passed an object containing the following possible parameters.

id
The id of the div you want the results of the results of the include inserted into. This parameter is required.
max
The maximum number of stories to return. It's best to always specify this parameter.
tag
An array of tag values. The default is the value of all the a elements on the page marked with rel="tag".
section
An Alweeklies.com section to fall back to if no results from the tags are found. The default is to return the empty string if there are no results.
pubexclude
The ID of a publication to exclude. You will likely want to use this to exclude your own publication from the results. To get the ID of a publication, find its page on the AltWeeklies.com website. In the URL of this page, the number after the ViewCompany?oid=oid%3A is the publication's ID.
summaries
A boolean value, default is true. Setting it to false will prevent the summaries of the stories from displaying.
callback
A function to run after the include. It will be passed the result of the query to Altweeklies.com. The default is a function that unhides the parent of the element specified by id, but only if there were any results.

rssTop Stories

Louisiana Education Numbers Don't Add Up

The Louisiana Department of Education is either cooking the books or simply incompetent in establishing the success of the voucher program Gov. Bobby Jindal wants to expand. Because the numbers just don’t add up.
The Independent Weekly  |  Heather Miller  |  02-09-2012  |  Education

Religious Liberty Threatened by Everything Obama Does From the Moment He Wakes Up

Tennessee GOP lawmakers are predictably hopping onto the bandwagon of verbal assault on the mandate that health insurance plans cover contraception and birth control without exemptions for religiously affiliated hospitals and universities.
Nashville Scene  |  Bruce Barry  |  02-09-2012  |  News
More Top Stories in »

The War on Weed

Illinois and many other states aggressively prosecute low-level pot users and dealers in the national war on drugs. But what's the cost, in both money and lives? And is it working?
Illinois Times  |  Bruce Rushton  |  02-09-2012  |  Drugs

The Horrors of the Gluten-Sensitive Sufferer

Imagine that for your entire life you have felt sick. Between the fatigue, stomach pains, and nausea, you have been stuck in an endless cycle of dining roulette. Needless to say, your life is scoring a wee bit low on the fun-scale.
Charleston City Paper  |  Nikki Seibert  |  02-09-2012  |  Health

Sugar-Coated

College students are hooking up with rich older men through sugar-daddy websires. Is it modern romance, or just an easy way to the sweet life?
Orlando Weekly  |  Lauren Holliday  |  02-09-2012  |  Lifestyles