Okay, we're moving along.  A bunch of nice changes over this past week:

== Using Latest Setup.rb ==

So, now: sudo ruby setup.rb alone works.  No CVS files.  That sort of thing.

== Central BaseContent class ==

The new content class hierarchy looks like this:

 BaseContent
   |-- IndexEntry
    -- BaseEntry
          |-- Entry
          |-- LinkList
           -- (YourCustomEntryClass)

Every entry type in your site is derived from BaseEntry. This class implies that the entry is an editable, searchable content object which should be loaded only as-needed.

The IndexEntry is always loaded, however. Your index.hobix file stores a big list of all your content, the basic information such as the `id', the `created' date, the `modified' date and the full `title'. You can also add your own fields thanks to work by Wm. Morgan.

To simplify the creation of custom IndexEntry classes, you now use the same notation used with the Entry classes.

 class IndexEntry
    _ :tagline
 end

Will store the :tagline field in the index for posts which contain it.

== The :no_load For skel_methods ==

If you have an archive page or something which doesn't need to load entire entries, you can pass a :no_load option from the skel_method, which will supply the Entry's IndexEntry rather than loading the full entry off disk.

For example, in listing the five most recent entries in the sidebar, you might just load the basics:

 class Hobix::Weblog
   # sidebar contains five newest entries
   def skel_sidebar( path_storage )
       entries = path_storage.find :lastn => 5
       page = Page.new( 'sidebar' )
       page.updated = path_storage.last_modified entries
       page.timestamp = entries.first.created
       yield :page => page, :entries => entries, :no_load => true
   end
 end

== BaseContent::link_format ==

If you want to change the basic link format of your blog, you can alter this method in your `lib/local.rb', which receives an Entry object.

 def Hobix::BaseContent.link_format e
     "#{ e.section_id }/#{ e.day_id }/#{ e.base_id }"
 end

Will cause stuff posted to `news/ruby-one-eight-two' to be placed at the canonical URL of `news/2005/07/22/ruby-one-eight-two'.

The URL and extension can also be transformed by replacing BaseContent::url_link.

== Dashes in the URL ==

If you place dashes in the post's URL name:

 hobix post ruby-lang news/rubyconf-2005-open-for-registration

The title will appear as: "Rubyconf 2005 Open For Registration" in the editor.

_why


_______________________________________________
Hobix-is-the-way mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/hobix-is-the-way

Reply via email to