Skip to content
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

tags should be sorted by date #34

Closed
tshepang opened this issue Oct 13, 2013 · 31 comments
Closed

tags should be sorted by date #34

tshepang opened this issue Oct 13, 2013 · 31 comments
Assignees
Labels
bug Well, it shouldn’t be doing that. Let’s fix it!
Milestone

Comments

@tshepang
Copy link

makes more sense to me; at the moment they are sorted by name

compare http://demo-moment.tshepang.net/tag/#Python
with http://tshepang.net/tags#Python-ref

@talha131
Copy link
Member

@tshepang Good catch. You mean articles for each tags should be sorted by their published date instead of name. This should be fixed I agree. In fact we should show date along with each article, just like we do in categories.

@tshepang
Copy link
Author

that's what I meant, sorry; glad you agree

@talha131
Copy link
Member

talha131 commented Nov 6, 2013

@tshepang articles under a tag are already sorted by date in descending order. Just like categories.

Which version of Pelican are you running? I tested it on 3.3.1.dev and couldn't reproduce the error.

@tshepang
Copy link
Author

tshepang commented Nov 6, 2013

I just pulled latest version from git master

@talha131
Copy link
Member

talha131 commented Nov 6, 2013

Great, do let me know if you still hit the same issue.

@tshepang
Copy link
Author

tshepang commented Nov 7, 2013

Oh sorry, I should have mentioned that I still experience the same issue. I expected it would be implied.

@talha131
Copy link
Member

talha131 commented Nov 8, 2013

@tshepang please share a git clone link to your blog source code. I will have to test it locally.

@tshepang
Copy link
Author

tshepang commented Nov 9, 2013

hg clone https://bitbucket.org/tshepang/blog

or

wget https://bitbucket.org/tshepang/blog/get/b9276d910e07.zip

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

@tshepang some of your articles do not have :date: defined which is resulting in anomalous output.

You can test it by assigning a new tag to few articles which have date property defined. You will see that articles under a123 are displayed in chronological order.

Pelican and Elegant are working as expected. Hope it was helpful.

@talha131 talha131 closed this as completed Nov 9, 2013
@tshepang
Copy link
Author

tshepang commented Nov 9, 2013

I no sure I understand. None of the Posts I see are sorted by date, under any tag. Does this mean that if just one Post lacks a Date field, the sorting becomes sorted alphabetically? Also, Pelican automatically appends date if none is supplied, in which case it uses mtime.

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

Elegant calls |sort on articles in a tag to display. We do not perform any other operation on it. Sort is performed by the Pelican. I cannot find any problem in sort operation in Pelican source code.

I created some new articles in your blog. I set date of some old articles. I assign all of them a new tag. They were displayed in chronological order as expected.

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

Let me know what you see when you set a new tag on articles that have date defined.

@tshepang
Copy link
Author

tshepang commented Nov 9, 2013

I did that and I still get them sorted alphabetically. I am using Python 3 and have not tried with Python 2.

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

Now I am totally baffled! My configuration is as follows

Python 2.7.2
Fabric==1.8.0
Jinja2==2.7.1
Markdown==2.3.1
MarkupSafe==0.18
Pygments==1.6
Sphinx==1.2b2
Unidecode==0.04.14
beautifulsoup4==4.3.1
blinker==1.3
docutils==0.11
feedgenerator==1.7
feedparser==5.1.3
paramiko==1.11.1
pelican==3.3
pycrypto==2.6
pytz==2013d
six==1.4.1
smartypants==1.8.2
typogrify==2.0.0
urwid==1.1.1
wsgiref==0.1.2

@tshepang
Copy link
Author

tshepang commented Nov 9, 2013

Ok, I've made a fresh install of Pelican, this time on Python 2, and I still get the same issue.

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

Can you try excluding articles that do not have date set? Pick a subset of articles and then test.

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

@tshepang If date of an article is not defined, Pelican uses mtime which is last modified date of a file. It can be changed by the file for a lot many reasons, like moving the file around, sync service can update and so on.

Now to your eyes that article is old but because of missing date, Pelican is using mtime of the file which is not old. As a result that article appears on top of your list.

@tshepang
Copy link
Author

tshepang commented Nov 9, 2013

I know about the limitations of relying on mtime.

BTW, I tested by creating new posts, all using the same tag, and all having the Date set. That's how I could reproduce the issue.

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

I know about the limitations of relying on mtime.

My apologies.

BTW, I tested by creating new posts, all using the same tag, and all having the Date set. That's how I could reproduce the issue.

I am officially out of ideas. I cannot reproduce this issue at all.

Can you please report this issue at Pelican repository?

@tshepang
Copy link
Author

tshepang commented Nov 9, 2013

the default theme works for me... does the sorting right

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

Hmm, I shall reinvestigate it.

@talha131
Copy link
Member

talha131 commented Nov 9, 2013

@tshepang I created a new blog from scratch and added few sample articles. I still failed to reproduce the issue. 😢

@tshepang
Copy link
Author

tshepang commented Nov 9, 2013

I just did the same too, both with Elegant and default theme, and only the default theme is sorted by date.

@talha131
Copy link
Member

This is my output
screen shot 2013-11-10 at 4 59 33 am

Please share output of pip freeze

@tshepang
Copy link
Author

That's not a good test since those are sorted alphabetically. The point is to show that they are sorted by date.

$ pip freeze                                                                                                                                                        
Jinja2==2.7.1                                                                                                                                                       
MarkupSafe==0.18                                                                                                                                                    
Pygments==1.6                                                                                                                                                       
Unidecode==0.04.14                                                                                                                                                  
argparse==1.2.1                                                                                                                                                     
beautifulsoup4==4.3.2                                                                                                                                               
blinker==1.3                                                                                                                                                        
docutils==0.11                                                                                                                                                      
feedgenerator==1.7                                                                                                                                                  
pelican==3.3                                                                                                                                                        
pytz==2013.8                                                                                                                                                        
six==1.4.1                                                                                                                                                          
wsgiref==0.1.2               

@talha131
Copy link
Member

  1. The reason you see tags sorted in default theme is that it does not show articles list in tags.html page. You see the list of articles on tag.html page.
  2. The reason it is hard to reproduce is that sorting result keeps changing on every run.
  3. Surprisingly, categories page does not display any similar bug.
  4. Took me long time to reproduce it.

@talha131
Copy link
Member

@tshepang I have fixed it to the best of my knowledge. Thanks for staying persistent.

  1. Can you please confirm the fix?
  2. Can you please confirm that categories page do not show this bug?

@talha131 talha131 reopened this Nov 10, 2013
@tshepang
Copy link
Author

tis fixed \0/
Categories page is good
thanks much for staying on with me, fixing this annoying issue

@tshepang
Copy link
Author

I see you have removed the sorting for Tags here: 3228f68#diff-b90e759d0454dce722b4332686b2b55eL41. Is that intentional?

talha131 added a commit that referenced this issue Nov 10, 2013
@talha131
Copy link
Member

thanks much for staying on with me, fixing this annoying issue

I am relieved! It was a hard to trace bug.

Is that intentional?

Thanks for pointing it out. I removed it thinking it was useless but your comment reminded me its purpose 😄

It is fixed now.

@tshepang
Copy link
Author

good stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Well, it shouldn’t be doing that. Let’s fix it!
Development

No branches or pull requests

2 participants