New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Related posts on GH Pages ordering #1240

Closed
swanson opened this Issue Jun 23, 2013 · 9 comments

Comments

Projects
None yet
6 participants
@swanson
Contributor

swanson commented Jun 23, 2013

Using this code on GH Pages (i.e. LSI off)

{% for post in site.related_posts limit:3 %}
    <a href="{{ post.url }}">{{ post.title }}</a>
{% endfor %}

My site is now returning the first three posts in the repo by date (i.e. from 2010) instead of the most recent three posts.

Seems like a regression to me.

Link to repo: https://github.com/swanson/swanson.github.com
Link to example on site: http://mdswanson.com/blog/2013/06/03/jekyll-201.html

@swanson

This comment has been minimized.

Show comment
Hide comment
@swanson

swanson Jun 23, 2013

Contributor

Tightening the assertion in test_related_posts as so:

    should "use the most recent posts for related posts" do
      @site.reset
      @site.read

      related_posts = Jekyll::RelatedPosts.new(@site.posts.last).build

      assert_equal @site.posts[0..9], related_posts
      assert_equal related_posts.first.title, "Number Category in YAML" 
    end

Results in a failure:

1) Failure:
test: building related posts without lsi should use the most recent posts for related posts. (TestRelatedPosts) [/Users/matt/dev/scratch/jekyll/test/test_related_posts.rb:20]:
<"Publish"> expected but was
<"Number Category in YAML">.

Where "Published" is the first post chronologically, and "Number Category in YAML" is the most recent.

Contributor

swanson commented Jun 23, 2013

Tightening the assertion in test_related_posts as so:

    should "use the most recent posts for related posts" do
      @site.reset
      @site.read

      related_posts = Jekyll::RelatedPosts.new(@site.posts.last).build

      assert_equal @site.posts[0..9], related_posts
      assert_equal related_posts.first.title, "Number Category in YAML" 
    end

Results in a failure:

1) Failure:
test: building related posts without lsi should use the most recent posts for related posts. (TestRelatedPosts) [/Users/matt/dev/scratch/jekyll/test/test_related_posts.rb:20]:
<"Publish"> expected but was
<"Number Category in YAML">.

Where "Published" is the first post chronologically, and "Number Category in YAML" is the most recent.

@swanson

This comment has been minimized.

Show comment
Hide comment
@swanson

swanson Jun 23, 2013

Contributor

Can also reproduce locally by turning LSI off - so it seem this issue is not specific to GH Pages

Contributor

swanson commented Jun 23, 2013

Can also reproduce locally by turning LSI off - so it seem this issue is not specific to GH Pages

@benbalter

This comment has been minimized.

Show comment
Hide comment
@benbalter

benbalter Jul 1, 2013

Contributor

I can reproduce the problem both locally and on GitHub pages (both sans LSI). I believe this is a regression as the related posts feature was working pre-1.0 and no code has changed.

It appears site.related_posts simply returns all posts in chronological order.

Site: http://ben.balter.com
Code: http://github.com/benbalter/benbalter.github.com

/ping @parkr

Contributor

benbalter commented Jul 1, 2013

I can reproduce the problem both locally and on GitHub pages (both sans LSI). I believe this is a regression as the related posts feature was working pre-1.0 and no code has changed.

It appears site.related_posts simply returns all posts in chronological order.

Site: http://ben.balter.com
Code: http://github.com/benbalter/benbalter.github.com

/ping @parkr

@mattr-

This comment has been minimized.

Show comment
Hide comment
@mattr-

mattr- Jul 1, 2013

Member

The code for related posts generation did change actually, as I refactored
some of it between 0.12 and 1.0. I'll see if I can't take a look and get it
fixed up.

On Mon, Jul 1, 2013 at 8:17 AM, Ben Balter notifications@github.com wrote:

I can reproduce the problem both locally and on GitHub pages (both sans
LSI). I believe this is a regression as the related posts feature was
working pre-1.0 and no code has changed.

It appears site.related_posts returns all posts in chronological order.

Site: http://ben.balter.com
Code: http://github.com/benbalter/benbalter.github.comhttps://github.com/benbalter/benbalter.github.com

/ping @parkr https://github.com/parkr


Reply to this email directly or view it on GitHubhttps://github.com/mojombo/jekyll/issues/1240#issuecomment-20280815
.

Member

mattr- commented Jul 1, 2013

The code for related posts generation did change actually, as I refactored
some of it between 0.12 and 1.0. I'll see if I can't take a look and get it
fixed up.

On Mon, Jul 1, 2013 at 8:17 AM, Ben Balter notifications@github.com wrote:

I can reproduce the problem both locally and on GitHub pages (both sans
LSI). I believe this is a regression as the related posts feature was
working pre-1.0 and no code has changed.

It appears site.related_posts returns all posts in chronological order.

Site: http://ben.balter.com
Code: http://github.com/benbalter/benbalter.github.comhttps://github.com/benbalter/benbalter.github.com

/ping @parkr https://github.com/parkr


Reply to this email directly or view it on GitHubhttps://github.com/mojombo/jekyll/issues/1240#issuecomment-20280815
.

@swanson

This comment has been minimized.

Show comment
Hide comment
@swanson

swanson Jul 7, 2013

Contributor

A work-around until this gets merged/deployed to GitHub Pages is to just use site.posts

{% for post in site.posts limit:3 %}
    <a href="{{ post.url }}">{{ post.title }}</a>
{% endfor %}
Contributor

swanson commented Jul 7, 2013

A work-around until this gets merged/deployed to GitHub Pages is to just use site.posts

{% for post in site.posts limit:3 %}
    <a href="{{ post.url }}">{{ post.title }}</a>
{% endfor %}
@mattr-

This comment has been minimized.

Show comment
Hide comment
@mattr-

mattr- Jul 8, 2013

Member

Pull request fixing this has now been merged.

Member

mattr- commented Jul 8, 2013

Pull request fixing this has now been merged.

@mattr- mattr- closed this Jul 8, 2013

mislav added a commit to mislav/blog that referenced this issue Jul 14, 2013

fix related posts ordering due to Jekyll bug
Will be fixed in Jekyll v1.0.4; until then do this workaround.

jekyll/jekyll#1240
@swanson

This comment has been minimized.

Show comment
Hide comment
@swanson

swanson Jul 31, 2013

Contributor

@parkr is there some kind of release schedule for this stuff to make it's way to GH Pages? I see that Pages is still on 1.0.3 and the tag is already into 1.1.x.

How long is it typically between GH Pages bumping the gem versions?

Contributor

swanson commented Jul 31, 2013

@parkr is there some kind of release schedule for this stuff to make it's way to GH Pages? I see that Pages is still on 1.0.3 and the tag is already into 1.1.x.

How long is it typically between GH Pages bumping the gem versions?

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jul 31, 2013

Member

@swanson It's generally between a week and a month, but it's hard to say. This version won't be put into production on GH:Pages for another week or two, I think.

Member

parkr commented Jul 31, 2013

@swanson It's generally between a week and a month, but it's hard to say. This version won't be put into production on GH:Pages for another week or two, I think.

@timblair

This comment has been minimized.

Show comment
Hide comment
@timblair

timblair Aug 20, 2013

Looks like the current in-production version is now 1.1.2 so this issue should be resolved.

The dependency versions can now be seen in the new pages-gem gemspec.

timblair commented Aug 20, 2013

Looks like the current in-production version is now 1.1.2 so this issue should be resolved.

The dependency versions can now be seen in the new pages-gem gemspec.

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.