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

Category sorting is not sufficient #2627

Closed
kayhayen opened this issue Jan 8, 2017 · 13 comments

Comments

Projects
None yet
2 participants
@kayhayen
Copy link
Contributor

commented Jan 8, 2017

Hello there,

I am using tags in "posts", to make my content easily browse able on http://speedcenter.nuitka.net/categories/index.html

With a "post", I am forced to give a date, presumably for ordering
purposes. I am currently using an old date, that I would even like
to be invisible. Or maybe I am going to use a reasonable one in
the future, e.g. the commit date of the test case. But it's going to
be the same one in a lot of cases if not always all cases.

The individual tags page is currently randomly sorted, listing the
cases in the RSS feed in arbitrary order, instead of sorting by name,
which would be better.

Is there a way, or any chance, you could add the slug or title as a
tie breaker when sorting posts with identical date? I presume this
must also affect 2 blog articles dated identically, order will be pseudo
random, file system order maybe?

Definitely not necessarily reproducible.

Thanks in advance,
Kay

@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 9, 2017

Currently, posts are sorted first by priority (which doesn't do anything if you didn't define priorities manually), then by date, and then by source_path of the post. Since I cannot see from the generated pages what the source paths were: do you have any "random" ID/hash/... in the source paths which could cause this?

@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 9, 2017

Oh: and which version of Nikola are you running?

@kayhayen

This comment has been minimized.

Copy link
Contributor Author

commented Jan 9, 2017

This was 7.8.1, but soon will be 7.8.2 which I have read about. If you consider e.g. this link (might go away, due to renames of tags coming up): http://speedcenter.nuitka.net/categories/27_develop_steady.html

You can see that I am using the default slug, and it appears not sorted. Or do you mean with source_path, the file system path? They all live in "constructs/construct-TitleCasedName", no hashes are used in paths.

Yours,
Kay

@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 9, 2017

Hmm, the sorting didn't change between 7.8.1 and 7.8.2, so 7.8.2 should have the same problem/bug. source_path is the path in the file system, so yeah, they should be sorted. I'll investigate that.

@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 9, 2017

I can't reproduce this. Would it be possible for you to upload the source files somewhere? Please use tar or something else which preserves file system ordering of files and doesn't sort the filenames in a directory.

@kayhayen

This comment has been minimized.

Copy link
Contributor Author

commented Jan 10, 2017

Here you go, this is a tar dump of my work directory, with "nuitka" and ".git" removed. It's not that huge. I am using ext4 file system in case that matters:

http://nuitka.net/volatile/issue_2627.tar.bz2

Running nikola with "build" and "deploy" is all I do in "update.py" which is my wrapper to create the RST files.

I somewhat merged my "conf.py" with default "conf.py" recently, but I didn't complete it. In my mind, it should not contain special stuff.

Yours,
Kay

@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 10, 2017

Thanks for the sources! Unfortunately, for me, the categories come out sorted.

(FYI: I removed almost all filters from the configuration except the hackContentClasses one. That shouldn't make a difference, though. And I didn't have pygal installed so I got no charts.)

Now I've looked in v7.8.1, and it turns out that the whole taxonomy-related code was rewritten since then (v7.8.1 was a bit older than I thought). In fact, it in v7.8.1, the posts per tags and categories weren't sorted with the same code as the timeline and others were (that was here: https://github.com/getnikola/nikola/blob/v7.8.1/nikola/nikola.py#L1981 and it is using the same sorting mechanism as in the current version).
Instead, the render_tags plugin did that manually here: https://github.com/getnikola/nikola/blob/v7.8.1/nikola/plugins/task/tags.py#L368 There you can see that it only cares about the date, and about nothing else.

So the result is that upgrading to v7.8.2 will fix the issue.

@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2017

PR #2630 fixes a remaining problem: the category post lists are sorted, but in reversed order than one would expect. The PR should fix that (and make it easier to replace the sorting order in the future).

Kwpolska added a commit that referenced this issue Jan 11, 2017

Improve documentation for #2627/#2630
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2017

@kayhayen: if you use the current github master, you should get your posts in expected order.

@kayhayen

This comment has been minimized.

Copy link
Contributor Author

commented Jan 12, 2017

I was updating to latest Nikola as first step to confirm that the original issue is fixed. The reverse order will be not nearly as annoying as unordered. I will however give master a shot later today.

@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2017

How that there's v7.8.3, you can simply use that instead of switching to github master.

@kayhayen

This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2017

I can confirm that 7.8.2 did do away with random sorting indeed, and that 7.8.3 sorts in the right order. Thanks a lot.

@kayhayen kayhayen closed this Jan 16, 2017

@felixfontein

This comment has been minimized.

Copy link
Contributor

commented Jan 16, 2017

Good to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.