randys.org

Wasting your precious bandwidth since 1999

Posts Tagged ‘mephisto’

Mephisto: How-to add monthly archives to the side-bar

One of the odd things I’m finding with Mephisto is that none of the templates I looked at had monthly archives in the sidebar. That’s generally not that strange, but Mephisto doesn’t really paginate (out of the box, anyway) sections (categories), so the lack of any way for a user (that would be you) to navigate to older posts is beyond me. So the search for some Liquid code to display monthly archives began.

Mephisto’s documentation is seriously lacking, but what can you expect from a small development team with no funding behind the app. Most of the links I followed were to the Mephisto Google Group. I took this snippet from one particular thread:

 <ul>
 {% for month in section.months %}
     {{ section | monthly_articles: month | assign_to: 'monthly_articles' }}
     <li>
     {% if monthly_articles %}
         {{ section | link_to_month: month }} ({{ monthly_articles | size }})
     {% else %}
         {{ month | format_date: 'my' }}
     {% endif %}
     </li>
 {% endfor %}
 </ul>

But this would still spit out months with no posts. We can’t have that! So, I turned it into this:

{% if section.months.size > 0 %}
<ul>
    <li class="head">Archives</li>
    {% for month in section.months %}
    {{ section | monthly_articles: month | assign_to: 'monthly_articles' }}
        {% if monthly_articles.size > 0 %}
            <li><span class="right">{{ monthly_articles | size }}</span>
            {{ section | link_to_month: month }} </li>
        {% endif %}
    {% endfor %}
</ul>
{% endif %}

Much better! Now I have this:

• • •

Long time, no post

I know it’s been a while. I’m sorry. I went through a phase where I just didn’t feel like contributing very much (hence the Tumblr episode). Don’t worry, the vast void of meaninglessness is still available and I’ll still be posting uninteresting tid-bits I find on the intertubes there.

So, last night I took it upon myself to give this site another chance. This time, with the help of Mephisto (another RoR blogging app). The install went smoothly. The conversion was a little bit of a pain, but I managed to make it work with a little help. So far, I like Mephisto. Better than Typo. It has less ‘bells and whistles’ but manages to have the essentials. And, it feels faster on my poor little 256MB VPS. It’s been running over night (granted with minimal to no traffic) and it’s currently sitting at ~40MB of memory (compared to the 60 - 80MB that Typo would suck on regularly).

Don’t get me wrong, Typo is a wonderful product. However, because I’m limited on RAM, I became frustrated with Rails thinking it was a complete memory hog. But that’s not the case really since I’m running Mephisto wich uses the same framework and the memory consumption is almost half of what Typo was using. If I had twice the memory, I’d probably still be using Typo… but I don’t and I can’t afford to throw more money into a site that doesn’t reciprocate.

I’m hoping to really dig into Ruby now. My crappy side gig with .e is winding down and I’m pretty much fed up with my day job so I’d like to move completely away from the Java/.NET environment I’m forced to work in everyday. Nothing would make me happier than be able to work on my Mac (or any Mac for that fact) doing PHP or better still, Ruby/Rails work. Call me snoby, I don’t care. It is what it is.

• • •

All content Copyright © Randy Sesser | Hosted by WebFaction
Entries (RSS) | Comments (RSS)