tesoriere logo

mephisto next article link, and previous article link

2009.04.17

8.2 either removed the two functions I used to manage article navigation at the bottom (move your eyes dowwwwn just above the comments), or I added them and thought they came for free. After looking at the date in the master repo the latter appears to be true!


#article_drop.rb

## this goes in app/drops/article_drop.rb
def next?
  !@source.next.blank?
end

def previous?
  !@source.previous.blank?
end


Then to use it, go to your liquid template and add the following somewhere important:

#previous link {% if article.previous? %} {{ article | previous_article | link_to_article }} {% else %} <a href="/">home</a> {% endif %} #next link {% if article.next? %} {{ article | next_article | link_to_article }} {% else %} <a href="/">home</a> {% endif %}

If you want the links to have different text, say next/previous, you need to change the previous like so

#previous link {% if article.previous? %} {{ article | previous_article | link_to_article: 'PREVIOUS' }} {% else %} <a href="/">home</a> {% endif %} #next link {% if article.next? %} {{ article | next_article | link_to_article: 'NEXT' }} {% else %} <a href="/">home</a> {% endif %}

It would appear that the prev/next_article filters check to see if one exists, but I prefer to link back to home for usability purposes, and this lets me do that.

tags:

mephisto - section with multiple pages on homepage (static intro page)

2008.06.21

mephisto picture

The way mephisto works, you can’t have a static intro page (one article per page, a ‘paged’ section), and a blog in a subdirectory (ie. /journal). These options are found under the ‘sections’ tab.

The reason it breaks is because of the way mephisto uses permanent links. It won’t prefix permanent links with the URL associated with their section.

There are a number of ways to fix this:
  1. sneaky template manuvering (the solution I took described below)
  2. changing the way permanent links are constructed in the mephisto code-base (seemingly the proper way) and submitting a patch to include it in future revisions
  3. just moving the whole mephisto installation to a subdirectory. This has it’s problems because you wouldn’t have access to the articles at all to slap on your introduction page. I use them to represent the ‘portfolio’ on this website.

The first method is the quickest; using the templates to achieve this is fairly simple and straightforward. In your ‘layout.liquid’, which is the default template, you can add the following:


{% if @section != nil %}
{% include 'home' %}
{% else %}
{% include 'journal'%}
{% endif %}

There also exists a ‘_home.liquid’ and ‘_journal.liquid’ template with however you want them to be designed. And that’s it!

tags:

new design

2008.06.04

There's a new design up today, and it came out pretty well. I still believe it needs more cowbell for it to truly shine. It runs on mephisto and uses slimbox for the lightbox popups.

tags:

dr lorne s. stitsky

2008.05.28

picture of drstitsky.com

I recently finished a web site for Dr. Lorne L. Stitsky, for his personal practice. His slogan is, "putting the care back into healthcare... one house call at a time". It's not just a marketing ploy either, he actually makes housecalls. I designed and developed the site, it uses Mephisto as a backend and Lightbox for the gallery.

Update: the site is pending a redesign to match Dr Stitsky's new theme. The website was created before he had a theme set in mind.

tags:

archives