Microsummaries: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Firefox 6 dropped support for proprietary microsummary format, now obsolete)
 
(27 intermediate revisions by 12 users not shown)
Line 1: Line 1:
== Introduction ==
== OBSOLETE ==
'''As of Firefox 6, [https://bugzilla.mozilla.org/show_bug.cgi?id=524091 support for microsummaries has been removed].'''


Microsummaries are regularly-updated succinct compilations of the most important information on web pages. They are compact enough to fit in the space available to a bookmark label, provide more useful information about pages than static page titles, and are regularly updated as new information becomes available.
Microsummaries are obsolete and not recommended for use. Some [http://microformats.org/wiki/page-summary-formats#Issues_2 issues with microsummary] have been documented.


Microsummaries are better than page titles at labeling bookmarks because they give users quicker access to the most interesting information behind a bookmark and provide sites with a way to notify users of updates and entice them to revisit the site.
Legacy documentation follows:


For an overview of microsummaries and their integration into Firefox, see [http://www.melez.com/mozilla/microsummaries/walkthrough.html this walkthrough] with screenshots showing major elements.  For detailed information, read the rest of this document.
== Introduction ==


Microsummaries are regularly-updated short summaries of web pages.  They are compact enough to fit in the space available to a bookmark label, they provide more useful information about pages than static page titles, and they get regularly updated as new information becomes available.


== Examples ==
Here are examples of possible microsummaries for some common types of pages:


Examples of pages for which microsummaries are useful include:
{| valign="top" style="border-collapse: collapse;"
|- style="font-weight: bold; background-color: #efefef; border-bottom: 1px solid black;"
| Type of Page
| Possible Microsummary
|
|- style="border-bottom: 1px solid black;"
| auction item
| '''Honda Accord - $5000 - 1 minute left'''<br>''(item name, current highest bid, and time remaining)''
|- style="border-bottom: 1px solid black;"
| product for sale
| '''Linksys WRT54G - $60 - in stock'''<br>''(product name, current price, and availability)''
|- style="border-bottom: 1px solid black;"
| news site
| '''BBC: Chirac to sign France's job law'''<br>''(latest headline)''
|- style="border-bottom: 1px solid black;"
| word of the day
| '''flat-hat'''<br>''(today's word)''
|- style="border-bottom: 1px solid black;"
| stock quote
| '''TWX: 16.94 + 0.30'''<br>''(stock price and movement)''
|- style="border-bottom: 1px solid black;"
| weather report
| '''SF: showers likely'''<br>''(current forecast)''
|- style="border-bottom: 1px solid black;"
| tinderbox
| '''3 burning'''<br>''(status of the tree)''
|- style="border-bottom: 1px solid black;"
| forum thread
| '''my first thread - 37 comments - last by Aaron'''<br>''(thread name, number of comments, and last commenter)''
|- style="border-bottom: 1px solid black;"
| support ticket
| '''tn79217 - in progress - J.Doe - eta: 3hrs'''<br>''(ticket number, status, owner, and ETA)''
|-
|}


* '''auction items:''' the item name, the current highest bid, and the time remaining, f.e. '''Honda Accord - $5000 - 1 minute left''';
Microsummaries are better for labeling bookmarks than static page titles, because they give users quicker access to the most interesting information behind a bookmark, and they give web sites a way to notify users of updates and entice them to revisit the site.
* '''products for sale:''' the product name, the current price, and whether or not the product is in stock, f.e. '''Linksys WRT54G - $60 - in stock''';
* '''news sites:''' the latest headline, f.e. '''BBC: Chirac to sign France's job law''';
* '''"[thing] of the day" pages:''' today's [thing], f.e. (for Merriam-Webster's word of the day page) '''flat-hat''';
* '''stock quotes:''' the current price of the stock and its movement in the market, f.e. '''TWX 16.94 + .30''';
* '''stock portfolios:''' your current net worth, f.e. '''net worth: $30k; +$500 today''';
* '''weather pages:''' the current forecast, f.e. '''SF: showers likely''';
* '''tinderbox:''' the status of the tree, f.e. '''3 tbxn burning''';
* '''insert your bright idea here'''.


A microsummary can be provided by a page itself (similar to the way pages provide RSS feeds of their contents) or by a microsummary generator, a type of Firefox add-on that contains instructions for extracting information from the contents of the page.


== Microsummary Definitions ==
== Using Microsummaries ==


Microsummaries can either be extracted from an RSS/Atom feed or generated by processing an XSLT stylesheet against the page being summarizedIn the latter case, the XSLT stylesheet and the pages to which it applies are provided by a microsummary definition.
As a user, when you bookmark a web page which provides a microsummary, you can choose to display the microsummary instead of the static page title as the "live title" for the bookmarkThen, when the microsummary changes, the bookmark title will update to reflect those changes, so you can get the latest updates about the information on the page just by looking at the bookmark.


A microsummary definition is a set of instructions for generating microsummariesDefinitions are expressed via an XML dialect with the namespace '''http://www.mozilla.org/microsummaries/0.1'''. A definition consists of a <definition> tag containing the following attributes and child elements:
You can also install a microsummary generator to get microsummaries for pages which don't provide their ownInstalling generators is as simple as installing search engine add-ons, and you use them the same way you use microsummaries provided by pages themselves.


* an '''id''' attribute that uniquely identifies the definition.  The recommended format for the ID attribute is @[author]/[site]/[name], where [author] identifies the developer of the definition, [site] identifies the site to which the definition applies, and [name] describes the definition, for example: '''@mozilla.org/bbc.co.uk/latest-headline''';
See [[Microsummaries/Using|Using Microsummaries]] for detailed instructions on installing generators and using microsummaries.  Then try it out with these examples of [http://people.mozilla.com/~myk/microsummaries/sites/ microsummary-enabled web sites] and [http://people.mozilla.com/~myk/microsummaries/generators/ microsummary generators].
* a '''name''' attribute that identifies the definition to users, f.e. '''Latest BBC Headline''';
* a '''<pages>''' child element with one or more <include>/<exclude> child elements containing regular expressions that identify the URIs to which the definition applies;
* a '''<template>''' element containing an XSLT stylesheet which generates a microsummary from a page.  The stylesheet can generate not only text but also HTML, graphics, and other rich content.


[Should a definition also contain an update interval or timeout specifying how often to update microsummaries or when to update them next?  How should this interval/timeout be specified?  Is it worth enabling complex specifications like "update every five minutes from 9:30am-4pm EST and not at all otherwise" for an NYSE stock quote?]


Here is an example microsummary definition:
== Providing Microsummaries for Your Web Site ==


  <definition xmlns="http://www.mozilla.org/microsummaries/0.1"
If you are a web site developer, you can provide microsummaries for the pages on your web site by creating them using the same tools and languages you already use to generate the pages, then linking to them from within the pages being summarized via <code>&lt;link&gt;</code> tags.
              id="@mozilla.org/bbc.co.uk/latest-headline;1"
              name="Latest BBC Headline">
 
    <pages>
 
      <include>^http://(www\.)?bbc\.co\.uk/$</include>
 
    </pages>
 
    <template>
 
      <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    version="1.0">
 
        <xsl:output method="text"/>
 
        <xsl:template match="/">
          <xsl:text>BBC: </xsl:text>
          <xsl:value-of select="normalize-space(id('rightColTable')/div/table[1]/tbody/tr/td[2]/table[2]/tbody/tr/td[3]/div[1]/a)"/>
        </xsl:template>
 
      </xsl:transform>
 
    </template>
 
  </definition>


== Specifying Microsummaries ==
For example, if you use a PHP script <code>index.php</code> to generate the home page for your site, you could add PHP code to the script which outputs a microsummary instead of the normal page content when the <code>view=microsummary</code> URL parameter is present.  Then just link to the microsummary within the normal page content using a <code>&lt;link&gt;</code> tag, i.e.:


Firefox, its users, the web sites they visit, and independent developers should all be able to specify microsummaries for pages.
  &lt;head&gt;
    ''&lt;link rel="microsummary" href="index.php?view=microsummary"&gt;''
  &lt;/head&gt;


=== Firefox ===
When Firefox encounters a <code>&lt;link&gt;</code> tag whose <code>rel</code> attribute is set to <code>microsummary</code>, it loads the URL in the <code>href</code> attribute and uses its content as the microsummary for the page.  If the content is plain text, Firefox uses it as-is.  If the content is HTML, however, Firefox first converts it to plain text (Firefox supports only plain text microsummaries at this time).


Firefox should be able to specify microsummaries via bundled microsummary definitions for popular sites.
Note: if the content at the URL is a microsummary generator, Firefox will use the generator to extract the microsummary from the contents of the page itself, so you can write code to generate the microsummary on the client instead of the server.  But generating microsummaries on the server-side is generally simpler and more efficient, so we recommend you take that approach.  If you do want to write a client-side generator, however, see the [http://developer.mozilla.org/en/docs/Creating_a_Microsummary Creating a Microsummary tutorial] and the [http://developer.mozilla.org/en/docs/Microsummary_XML_grammar_reference Microsummary XML grammar reference].


=== Users ===
Note the additional information available in [http://developer.mozilla.org/en/docs/Microsummary_topics Microsummary topics].


Users should be able to specify microsummaries via a microsummary builder feature in Firefox that lets users extract text snippets from a rendered page via simple methods like drag-and-drop and string them together along with arbitrary text into a microsummary.  Implementation of a microsummary builder is deferred to the future.
== Writing Microsummary Generator Add-ons ==


=== Sites ===
If you are an add-ons developer for Firefox with knowledge of XML and XSLT, you can create microsummary generator add-ons which generate microsummaries for sites that don't provide them.


Sites should be able to specify microsummaries by embedding metadata referencing microsummary definitions or RSS/Atom feeds into pagesFor example, a site might embed one of the following two <link> elements into an HTML page:
To learn how to create generator add-ons and make them available to Firefox users, see the [http://developer.mozilla.org/en/docs/Creating_a_Microsummary Creating a Microsummary tutorial]Also see the [http://developer.mozilla.org/en/docs/Creating_regular_expressions_for_a_microsummary_generator Creating regular expressions for a microsummary generator tutorial] for a step-by-step guide to writing regular expressions that specify the pages to which your generators should apply.


  <link rel="microsummary" type="application/x.microsummary+xml" href="/index-microsummary.xml">
Refer to the [http://developer.mozilla.org/en/docs/Microsummary_XML_grammar_reference Microsummary XML grammar reference] for the details of the Microsummary XML grammar, and note the additional information available in [http://developer.mozilla.org/en/docs/Microsummary_topics Microsummary topics].
  <link rel="microsummary" type="application/x.atom+xml" href="/index-microsummary.xml">


Or it might embed one of the following two XML processing instructions into an XML document:
== Technical Details ==


  <?microsummary type="application/x.microsummary+xml" href="/index-microsummary.xml"?>
Most of the microsummaries code in Firefox is located in the [http://lxr.mozilla.org/mozilla/source/browser/components/microsummaries/ browser/components/microsummaries] directory. The <code>MicrosummaryService</code> component and related components are implemented in [http://lxr.mozilla.org/mozilla/source/browser/components/microsummaries/src/nsMicrosummaryService.js.in nsMicrosummaryService.js.in].  Public scriptable interfaces are defined in [http://lxr.mozilla.org/mozilla/source/browser/components/microsummaries/public/nsIMicrosummaryService.idl nsIMicrosummaryService.idl].
  <?microsummary type="application/x.atom+xml" href="/index-microsummary.xml"?>


For RSS/Atom feed-based microsummaries, Firefox will use profiles of the RSS and Atom specifications to extract microsummaries via the following rules:
The microsummary service updates microsummaries when they expire and provides an API for front-end code to access microsummaries register itself to be notified when they get updated.


* if the rss:channel/atom:feed element contains no items/entries, the microsummary is the value of the rss:description/atom:subtitle element;
Like the livemarks service, the microsummary service checks every 15 seconds for microsummaries that need updating. When a microsummary needs updating, the service downloads the necessary content (i.e. the microsummary, the page, the generator), processes it as needed to generate a microsummary, and stores the updated microsummary in the datastore.  The bookmarks UI templates/controllers then get notified of those changes and rebuilds the bookmarks UI as appropriate.
* if the rss:channel/atom:feed element contains one item/entry, the microsummary is the value of the item's/entry's rss:description/atom:summary element;
* if the rss:channel/atom:feed element contains more than one item/entry:
** if the items/entries are dated via rss:pubDate/atom:published/atom:updated elements, the microsummary is the value of the rss:description/atom:summary element of the most recent item/entry;
** if the items/entries are not dated, the microsummary is the value of the rss:description/atom:summary element of the first item/entry.


[If a page points to a microsummary definition whose <pages> list does not include the page, should the microsummary service ignore the <pages> list and apply the definition to the page anyway?]
=== Datastore ===


=== Independent Developers ===
In Firefox 2, the service stores microsummaries and their meta-data as properties of the RDF resources that represent bookmarks in the bookmarks data source. In Firefox 3 with Places enabled, the service stores the same information as annotations in the annotations datastore via the annotation service. Microsummary data includes:


Independent developers should be able to specify microsummaries by packaging microsummary definitions into addons that users can acquire from a directory of such addons similar to the extensions/themes directory at addons.mozilla.org.  Microsummary definitions packaged in this way are called microsummary support packs.  Developers should be able to package multiple definitions into a single pack.  Packs should be automatically updatable.
* generated title: the content of the microsummary (i.e. what Firefox displays to users);
* source URI: a unique URI identifying the generator;
* expiration: the time (in microseconds since the epoch) at which the microsummary will expire.


[Should packs use the extensions model, i.e. packaged as XPIs and subject to origin restrictions, or should they use the search engines model, i.e. no origin restrictions?
=== Bookmarks Dialogs ===


If packs use the extensions model, the XPIs might contain a definitions.xml file, a directory of such files, or both, i.e.:
The Add Bookmark and Bookmark Properties dialogs let the user choose to display a microsummary for the bookmark by turning the Name field into an editable menulist if a microsummary is available. The menulist includes one item for each available microsummary along with an item for the static page title, so the user can choose to display either the static title or a microsummary.


  XPI
As before, the user can edit the static page title. If the user selects a microsummary and then edits it, the text of the microsummary becomes the static page title. This may prove confusing for users, who expect to be able to edit a microsummary and still have it be a dynamically updating microsummary, so we should monitor user experience of this UI and modify it as appropriate.
    install.rdf
    [definitions.xml]
    [definitions/
      *.xml]


]
The dialog retrieves microsummaries via nsIMicrosummaryService.getMicrosummaries() and updates the datastore per the user's selection via nsIMicrosummaryService.setMicrosummary() and nsIMicrosummaryService.removeMicrosummary().


=== Bookmarks Toolbar/Sidebar/Menu ===


== Back-end Implementation ==
When the user chooses a microsummary for a bookmarked page, the bookmarks toolbar, sidebar, and menu display the microsummary instead of the page title as the label for the bookmark.  When the microsummary service updates the microsummary, the bookmarks UI updates the label using an implementation-specific mechanism (XUL template observing the bookmarks datasource for the old bookmarks code, controller registered as a microsummary observer for the Places code).


The microsummary service updates microsummaries when they expire and provides an API for front-end code to access microsummaries and be notified when they get updated.
After the microsummary service updates the microsummary and the bookmarks UI updates, we may want the bookmarks toolbar to display some indication that an update has taken place.  Perhaps we could subtly throb the label for a short time.  We might also want to provide a way for the user to find out when the microsummary was last updated.


Like the livemarks service, the microsummary service checks every 15 seconds for microsummaries that need updating.  If a microsummary needs updating, the service downloads the necessary content (i.e. the page or its feed), processes it to generate an updated microsummary, and stores the updated microsummary in the datastore.
[The mechanism by which the bookmarks controller identifies and observes microsummary bookmarks should be extensible (i.e. a generic "metadata observer") so that future code (both native and extensions) can register additional bookmark types with metadata whose observation triggers activity.]


=== nsIMicrosummaryService ===
Additional integration points may be defined in the future (f.e. microsummaries might be displayed as tab labels).


  [scriptable, uuid(c5e9c390-beb0-4eb4-90ab-529efc817632)]
== Standardization ==
  interface nsIMicrosummaryService : nsISupports
  {
      /**
      * Retrieves a list of available microsummaries for a given URI.
      * The aDoc argument is optional.  If present, this method will use it
      * to generate the microsummaries.  Otherwise, microsummary content
      * may not be available, in which case this method will return microsummary
      * objects without content.  Callers who receive such objects should use
      * the microsummary definition name in lieu of microsummary content.
      *
      * @param aURI  the URI of the microsummarized page
      * @param aDoc  the document to which the URI refers
      * @returns an enumerator of nsIMicrosummary objects
      */
      nsISimpleEnumerator getMicrosummaries(in nsIURI aURI, in nsIDOMNode aDoc);
 
      /**
      * Manually updates the microsummary for a given URI.  The aDoc argument
      * is optional.  If present, this method will use it to update the microsummary
      * Otherwise it will download the document asynchronously.
      *
      * @param aURI  the URI of the microsummarized page
      * @param aDoc  the document to which the URI refers
      *
      */
      void updateMicrosummary(in nsIURI aURI, in nsIDOMNode aDoc);
 
      /**
      * Sets the microsummary for a given URI.
      *
      * @param aURI          the URI of the microsummarized page
      * @param aMicrosummary  the microsummary to set
      *
      */
      void setMicrosummary(in nsIURI aURI, in nsIMicrosummary aMicrosummary);
 
      /**
      * Removes the microsummary for a given URI.
      *
      * @param aURI          the URI of the microsummarized page
      *
      */
      void removeMicrosummary(in nsIURI aURI);
 
      /**
      * Adds a microsummary observer.
      *
      */
      void addObserver(in nsIAnnotationObserver aObserver);
 
      /**
      * Removes a microsummary observer previously registered by addObserver.
      *
      */
      void removeObserver(in nsIAnnotationObserver aObserver);
  };
 
=== nsIMicrosummaryObserver ===
 
  [scriptable, uuid(de8ac63a-3867-4dad-a631-ba1d8869d733)]
  interface nsIMicrosummaryObserver : nsISupports
  {
      /**
      * Called when the microsummary service starts updating a microsummary.
      *
      * @param aURI  the URI of the microsummarized page
      *
      */
      void onStartUpdate(in nsIURI aURI);
 
      /**
      * Called when the microsummary service stops updating a microsummary.
      *
      * @param aURI  the URI of the microsummarized page
      *
      */
      void onStopUpdate(in nsIURI aURI);
  };
 
=== nsIMicrosummary ===
 
  [scriptable, uuid(f9d1a73c-e147-46f3-ba61-4f0bd33f5d47)]
  interface nsIMicrosummary : nsISupports
  {
      // for microsummaries specified via a bundled or installed definition,
      // the nsIMicrosummaryDefinition for this microsummary
      readonly attribute nsIMicrosummaryDefinition definition;
 
      // for microsummaries specified via a <link> element pointing to
      // a microsummary definition or RSS/Atom feed, the URI of the resource
      readonly attribute nsIURI uri;
 
      // the URI of the page being summarized
      // XXX Should this be the ID of the page in the history datastore?
      readonly attribute nsIURI page;
 
      // the content of the microsummary
      readonly attribute nsIDOMNode content;
  };


=== nsIMicrosummaryDefinition ===
The microsummary generator dialect and the use of the <link rel> element to specify microsummaries should be standardized by the appropriate bodies, which may include the microformats group and the WHATWG.


  [scriptable, uuid(ff3eba15-81de-4c24-bfcf-c8180dc3c00a)]
== Resources ==
  interface nsIMicrosummaryDefinition : nsISupports
  {
      // the unique identifier for this microsummary definition;
      // corresponds to the 'id' attribute of the <definition> element
      readonly attribute string id;
 
      // the user-friendly name for this microsummary definition;
      // corresponds to the 'name' attribute of the <definition> element
      readonly attribute string name;
 
      // the XSLT stysheet by which we generate the microsummary;
      // corresponds to the <template> child of the <definition> element
      readonly attribute nsIDOMNode template;
  };


=== Datastore ===
=== Tutorials ===
* [http://developer.mozilla.org/en/docs/Creating_a_Microsummary Creating a Microsummary]
* [http://developer.mozilla.org/en/docs/Creating_regular_expressions_for_a_microsummary_generator Creating regular expressions for a microsummary generator]


The microsummary service stores microsummaries and their meta-data as annotations in the annotations datastore via the annotation service.  Microsummary annotations include:
=== Examples ===


* microsummary/content: the microsummary content (i.e. what Firefox displays to users);
==== Generators ====
* microsummary/id: for microsummaries specified by bundled or installed definitions, the unique identifier of the microsummary definition containing the template;
* microsummary/uri: for microsummaries specified by <link rel="microsummary"> elements embedded in page headers, the URI of the resource identified by the <link> element.
* microsummary/expiration: the time in microseconds since the epoch at which the microsummary will expire.


* [http://people.mozilla.com/~myk/microsummaries/generators/ microsummary generators]
* [http://www.etf.cuni.cz/~tomasek/pub/microsummaries/install.html generators for Czech sites]
* [http://userstyles.org/livetitle/ Live Titles] - microsummary generators repository


== Front-end Implementation ==
==== Sites ====


The initial integration points are the bookmark properties dialog and the bookmarks toolbar.
See examples of sites that provide microsummaries at [[Microsummaries/Sites]].


Since microsummaries can contain HTML and other unsafe content, they should be inserted into the UI inside untrusted iframes wherever they appear.
=== Other Docs ===
* [[Microsummaries/Using|Using Microsummaries]]
* [http://developer.mozilla.org/en/docs/Microsummary_XML_grammar_reference Microsummary XML grammar reference]
* [http://developer.mozilla.org/en/docs/Microsummary_topics Microsummary topics]


=== Bookmark Properties Dialog ===
== Tools ==
 
The bookmark properties dialog lets the user choose to display a microsummary for the bookmark.  If multiple microsummaries are available, the dialog lets users choose between them.  The dialog retrieves microsummaries via nsIMicrosummaryService.getMicrosummariesForURI() and updates the datastore per the user's selection via nsIMicrosummaryService.setMicrosummary() and nsIMicrosummaryService.removeMicrosummary().
 
=== Bookmarks Toolbar ===
 
When a microsummary is set for a bookmarked URI, the bookmarks toolbar displays the microsummary instead of the page title as the label of the bookmark.  When the microsummary service updates the microsummary, the bookmarks toolbar updates the label.  While the microsummary service is in the process of updating the microsummary, the bookmarks toolbar displays some UI indicating that an update is underway (f.e. it replaces the favicon with a throbber for the duration of the update).
 
The toolbar displays microsummaries via a template rule that applies only to bookmarks with microsummaries.  The toolbar controller registers itself with the microsummary service as a microsummary observer in order to be notified when a microsummary gets updated.
 
[Is the annotation observer interface sufficient for this task?  I.e. is it sufficient for the toolbar controller to merely register itself as an annotation observer of the microsummary/content annotation?  Probably not, since the annotation observer doesn't let you observe that an update to the annotation is underway.]
 
[The mechanism by which the bookmarks controller identifies and observes microsummary bookmarks should be extensible (i.e. a generic "metadata observer") so that future code (both native and extensions) can register additional bookmark types with metadata whose observation triggers activity.]
 
Additional integration points may be defined in the future (f.e. microsummaries might be displayed as tab labels).
 
 
== Standardization ==


The microsummary definition dialect and the use of the <link rel> element to specify microsummaries should be standardized by appropriate bodies. Appropriate bodies for standardization may include the [http://microformats.org/wiki/Main_Page microformats group] and the WHATWG.
=== Extensions ===
* [https://addons.mozilla.org/firefox/3639/ Microsummary Buddy] - display an icon in the location bar when a microsummary is available for a page
* [https://addons.mozilla.org/firefox/3741/ Microsummary Generator Builder] - build a Microsummary Generator, based on a selection on the current web page
* [https://addons.mozilla.org/firefox/4248/ Microsummary Manager] - shows installed Microsummaries in the Add-ons manager and provides UI for deleting them

Latest revision as of 15:21, 4 August 2011

OBSOLETE

As of Firefox 6, support for microsummaries has been removed.

Microsummaries are obsolete and not recommended for use. Some issues with microsummary have been documented.

Legacy documentation follows:

Introduction

Microsummaries are regularly-updated short summaries of web pages. They are compact enough to fit in the space available to a bookmark label, they provide more useful information about pages than static page titles, and they get regularly updated as new information becomes available.

Here are examples of possible microsummaries for some common types of pages:

Type of Page Possible Microsummary
auction item Honda Accord - $5000 - 1 minute left
(item name, current highest bid, and time remaining)
product for sale Linksys WRT54G - $60 - in stock
(product name, current price, and availability)
news site BBC: Chirac to sign France's job law
(latest headline)
word of the day flat-hat
(today's word)
stock quote TWX: 16.94 + 0.30
(stock price and movement)
weather report SF: showers likely
(current forecast)
tinderbox 3 burning
(status of the tree)
forum thread my first thread - 37 comments - last by Aaron
(thread name, number of comments, and last commenter)
support ticket tn79217 - in progress - J.Doe - eta: 3hrs
(ticket number, status, owner, and ETA)

Microsummaries are better for labeling bookmarks than static page titles, because they give users quicker access to the most interesting information behind a bookmark, and they give web sites a way to notify users of updates and entice them to revisit the site.

A microsummary can be provided by a page itself (similar to the way pages provide RSS feeds of their contents) or by a microsummary generator, a type of Firefox add-on that contains instructions for extracting information from the contents of the page.

Using Microsummaries

As a user, when you bookmark a web page which provides a microsummary, you can choose to display the microsummary instead of the static page title as the "live title" for the bookmark. Then, when the microsummary changes, the bookmark title will update to reflect those changes, so you can get the latest updates about the information on the page just by looking at the bookmark.

You can also install a microsummary generator to get microsummaries for pages which don't provide their own. Installing generators is as simple as installing search engine add-ons, and you use them the same way you use microsummaries provided by pages themselves.

See Using Microsummaries for detailed instructions on installing generators and using microsummaries. Then try it out with these examples of microsummary-enabled web sites and microsummary generators.


Providing Microsummaries for Your Web Site

If you are a web site developer, you can provide microsummaries for the pages on your web site by creating them using the same tools and languages you already use to generate the pages, then linking to them from within the pages being summarized via <link> tags.

For example, if you use a PHP script index.php to generate the home page for your site, you could add PHP code to the script which outputs a microsummary instead of the normal page content when the view=microsummary URL parameter is present. Then just link to the microsummary within the normal page content using a <link> tag, i.e.:

 <head>
   <link rel="microsummary" href="index.php?view=microsummary">
 </head>

When Firefox encounters a <link> tag whose rel attribute is set to microsummary, it loads the URL in the href attribute and uses its content as the microsummary for the page. If the content is plain text, Firefox uses it as-is. If the content is HTML, however, Firefox first converts it to plain text (Firefox supports only plain text microsummaries at this time).

Note: if the content at the URL is a microsummary generator, Firefox will use the generator to extract the microsummary from the contents of the page itself, so you can write code to generate the microsummary on the client instead of the server. But generating microsummaries on the server-side is generally simpler and more efficient, so we recommend you take that approach. If you do want to write a client-side generator, however, see the Creating a Microsummary tutorial and the Microsummary XML grammar reference.

Note the additional information available in Microsummary topics.

Writing Microsummary Generator Add-ons

If you are an add-ons developer for Firefox with knowledge of XML and XSLT, you can create microsummary generator add-ons which generate microsummaries for sites that don't provide them.

To learn how to create generator add-ons and make them available to Firefox users, see the Creating a Microsummary tutorial. Also see the Creating regular expressions for a microsummary generator tutorial for a step-by-step guide to writing regular expressions that specify the pages to which your generators should apply.

Refer to the Microsummary XML grammar reference for the details of the Microsummary XML grammar, and note the additional information available in Microsummary topics.

Technical Details

Most of the microsummaries code in Firefox is located in the browser/components/microsummaries directory. The MicrosummaryService component and related components are implemented in nsMicrosummaryService.js.in. Public scriptable interfaces are defined in nsIMicrosummaryService.idl.

The microsummary service updates microsummaries when they expire and provides an API for front-end code to access microsummaries register itself to be notified when they get updated.

Like the livemarks service, the microsummary service checks every 15 seconds for microsummaries that need updating. When a microsummary needs updating, the service downloads the necessary content (i.e. the microsummary, the page, the generator), processes it as needed to generate a microsummary, and stores the updated microsummary in the datastore. The bookmarks UI templates/controllers then get notified of those changes and rebuilds the bookmarks UI as appropriate.

Datastore

In Firefox 2, the service stores microsummaries and their meta-data as properties of the RDF resources that represent bookmarks in the bookmarks data source. In Firefox 3 with Places enabled, the service stores the same information as annotations in the annotations datastore via the annotation service. Microsummary data includes:

  • generated title: the content of the microsummary (i.e. what Firefox displays to users);
  • source URI: a unique URI identifying the generator;
  • expiration: the time (in microseconds since the epoch) at which the microsummary will expire.

Bookmarks Dialogs

The Add Bookmark and Bookmark Properties dialogs let the user choose to display a microsummary for the bookmark by turning the Name field into an editable menulist if a microsummary is available. The menulist includes one item for each available microsummary along with an item for the static page title, so the user can choose to display either the static title or a microsummary.

As before, the user can edit the static page title. If the user selects a microsummary and then edits it, the text of the microsummary becomes the static page title. This may prove confusing for users, who expect to be able to edit a microsummary and still have it be a dynamically updating microsummary, so we should monitor user experience of this UI and modify it as appropriate.

The dialog retrieves microsummaries via nsIMicrosummaryService.getMicrosummaries() and updates the datastore per the user's selection via nsIMicrosummaryService.setMicrosummary() and nsIMicrosummaryService.removeMicrosummary().

Bookmarks Toolbar/Sidebar/Menu

When the user chooses a microsummary for a bookmarked page, the bookmarks toolbar, sidebar, and menu display the microsummary instead of the page title as the label for the bookmark. When the microsummary service updates the microsummary, the bookmarks UI updates the label using an implementation-specific mechanism (XUL template observing the bookmarks datasource for the old bookmarks code, controller registered as a microsummary observer for the Places code).

After the microsummary service updates the microsummary and the bookmarks UI updates, we may want the bookmarks toolbar to display some indication that an update has taken place. Perhaps we could subtly throb the label for a short time. We might also want to provide a way for the user to find out when the microsummary was last updated.

[The mechanism by which the bookmarks controller identifies and observes microsummary bookmarks should be extensible (i.e. a generic "metadata observer") so that future code (both native and extensions) can register additional bookmark types with metadata whose observation triggers activity.]

Additional integration points may be defined in the future (f.e. microsummaries might be displayed as tab labels).

Standardization

The microsummary generator dialect and the use of the <link rel> element to specify microsummaries should be standardized by the appropriate bodies, which may include the microformats group and the WHATWG.

Resources

Tutorials

Examples

Generators

Sites

See examples of sites that provide microsummaries at Microsummaries/Sites.

Other Docs

Tools

Extensions