Goal: I just want to see the gravatars not only for comments but in the article’s title also.
I have no prior knowledge of Mephisto (this is my second day with it) nor Liquid. So, here is how i did it … may be far from perfect but it seems to pull it off:
There is already a method
gravatar that receives a hash with the comment properties and does the trick.
So, placing the following line in the right spot of the appropriate liquid file (for me that’s the _article.liquid file) should be enough:
Articles are a little more tricky
Since there is no support in for gravatars for article’s author i’ve coded a simple initializer to add a new method for this purpose and keep the original code as clean as possible. This initializer adds the method
gravatar_for_article to the UrlFilters module.
1 2 3 4 5 6 7 8 9
The code above creates a new hash from some of the article’s properties to mock the comment structure and passes it to the original
Now, place the following line inside the article’s header and voilá.
Style it and you’re done.