Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7836713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:16:31+00:00 2026-06-02T14:16:31+00:00

I really need help with Jekyll. I’m desesperately trying to generate pages where posts

  • 0

I really need help with Jekyll.
I’m desesperately trying to generate pages where posts are grouped by date.

What I want is to have a home page with all posts of the current month and then the possibility to browse every months. So I’ve got to generate an index page and generate all other monthly pages.

I’m new to ruby and Jekyll so I’m really exploring.
My home page is working with some ugly code but my monthly pages aren’t working : the post content is not “compiled” and appear in raw textile.

My generator class looks like this :

class MonthlyGenerator < Generator
safe true

def group_by_month(posts)
  months = []
  posts_by_month = {}
  posts.reverse.each do |post|
    key = Time.utc(post.date.year, post.date.month)
    if posts_by_month.has_key?(key)
      posts_by_month[key] << post
    else
      posts_by_month[key] = [post]
      months << key
    end
  end
  return [months,posts_by_month]
end

def generate(site)
  data = group_by_month(site.posts)
  months = data[0]
  posts_by_month = data[1]
  months.each_with_index do |month, index|
    if index >= 0 && index < months.length
      nextMonth = months[index+1]
    else 
      nextMonth = false
    end
    if index > 0 && index <= months.length
      previousMonth = months[index-1]
    else 
      previousMonth = false
    end 
    posts = posts_by_month[month]

    dir = "/"+month.year.to_s+"-"+month.mon.to_s
    write_monthly_posts(site, dir, month, posts, nextMonth, previousMonth)
  end
end

def write_monthly_posts(site, dir, month, posts, nextMonth, previousMonth)
    monthlypage = MonthlyPage.new(site, dir, month, posts, nextMonth, previousMonth)
    monthlypage.render(site.layouts, site.site_payload)
    monthlypage.write(site.dest)
    site.pages << monthlypage
end
end

And my template monthly.html :

<div class="span3">
  <h1>{{ page.month }}</h1>
</div>
<div class="span9">
  {% for post in page.posts %}
      <a href="{{ post.url }}">{{ post.title | truncate:65 }}</a>
      {{ post.content }}
  {% endfor %}
</div>

The output is this one :

<div class="span3">
    <h1>Sat Nov 01 00:00:00 UTC 2008</h1>
</div>
<div class="span9">

      <a href="/cat1/2008/11/19/test2.html">Test2</a>
       h1. test 

p(meta). 1nounmjlkjlktest2

2008 is a leap year. That means that three hundred and sixty six days 


<iframe class="video" src="http://player.vimeo.com/video/?title=0&amp;byline=0&amp;portrait=0" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen>
</iframe>

</div>

the content is still in textile.
Any idea ?
Thanks a lot !
Alexandre


update :

the solution :

{{ post.content | textilize }}

doesn’t work because it doesn’t take into account values set in my post.textile file.


Solution :

I found something, If I force a post to render in the loop, it does the job :

def group_by_month(posts, site) 
    months = [] posts_by_month = {} 
    posts.reverse.each do |post| 
        post.render(site.layouts, site.site_payload) 
        key = Time.utc(post.date.year, post.date.month) 
        if posts_by_month.has_key?(key) 
            posts_by_month[key] << post 
        else 
            posts_by_month[key] = [post] 
            months << key 
        end 
    end 
    return [months,posts_by_month] 
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:16:38+00:00Added an answer on June 2, 2026 at 2:16 pm

    Found Solution :

    I found something, If I force a post to render in the loop, it does the job :

    def group_by_month(posts, site) 
        months = [] posts_by_month = {} 
        posts.reverse.each do |post| 
            **post.render(site.layouts, site.site_payload)**
            key = Time.utc(post.date.year, post.date.month) 
            if posts_by_month.has_key?(key) 
                posts_by_month[key] << post 
            else 
                posts_by_month[key] = [post] 
                months << key 
            end 
        end 
        return [months,posts_by_month] 
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really need some help with this as I have been trying to fix
I really need help here. I'm desperate at this point. I have NSOperation that
I do not have very much knowledge of programming and really need help. I
I really need help. My problem now is i want to display the books
I have another exercise I have to do that I really need help with.
I really need help with this one. I have written an adding that adds
I need help, This is what am actually trying to do. I have two
I really need help with my ASP.NET MVC 2 site... Simply put, I have
I really need help... I have implemented a COM component (i.e A.dll) with IDL,
I really really need help. Been trying to get this on and off for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.