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

Truncated title_path/permalinks #88

Closed
jjk-jacky opened this Issue May 22, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@jjk-jacky
Copy link
Contributor

jjk-jacky commented May 22, 2016

I'm having a little issue with the way title_path is being constructed, because I happen to use dots in some of my post titles. E.g. imagine a post made from a file spress-2.1.1-released.md it would get a title_path spress-2.1.1-released
However, if there's a date, e.g. 2016-02-02-spress-2.1.1-released.md then the title_path generated would be spress-2-1

The most obvious issue is that it's missing the end, I believe because FilesystemDataSource (in isDateFilename) tries to account for "double extension" I guess, like foo.html.twig or something. But this is obviously causing issues here.
I'm not sure how to (best) fix this, I've simply removed the "double extension" support from the regex right now, but maybe this should be based on an option? Unless there's a known list of such possible "double extension" to use?

Another issue is that the dots are turned into dashes, which doesn't seem to happen when no date is used. This isn't very consistent, and since we're talking about it I'd rather have dots remain as is, so from 2016-02-02-spress-2.1.1-released.md the title_path would be spress-2.1.1-released

@yosymfony yosymfony self-assigned this May 22, 2016

@jjk-jacky

This comment has been minimized.

Copy link
Contributor

jjk-jacky commented May 23, 2016

Quick addition, having thought about this a bit more: I think there are 2 bugs indeed:

First one is the title being truncated due to the "double extension" support;

Second is that (I believe) with preverse_path_title the intent is to use the title from the filename, where we've already taken care of case, replacing spaces with dashes and whatnot, so it should be used as is: don't replace anything, don't even put in lowercase, nothing. Just remove the date prefix and extension, nothing else.

@yosymfony

This comment has been minimized.

Copy link
Member

yosymfony commented May 25, 2016

@jjk-jacky the intent of preverse_path_title attribute is to tell Spress uses the tittle from the filename for generating permalinks. That is usefull with languages such as Chinese.

@jjk-jacky

This comment has been minimized.

Copy link
Contributor

jjk-jacky commented May 25, 2016

Right, so it implies the title in question, i.e. the filename, has
already gone through some manual sanitization: removing "invalid"
characters, replacing spaces with dashes, etc

So basically, there's no need to process it any further - unlike a
title meant for display.

@yosymfony

This comment has been minimized.

Copy link
Member

yosymfony commented May 28, 2016

I'll use text_extensions param of FilesystemDataSource class for finding out the extension of a filename. text_extensions contains a list of filename's extensions considered as text files. such list contains simple and compound filename extensions such as html.twig

@yosymfony yosymfony added the Bug label May 28, 2016

yosymfony added a commit that referenced this issue Jun 3, 2016

Fixed the truncated `title_path` attribute when the filename contains…
… dots before the extension. More details in bug #88

yosymfony added a commit that referenced this issue Jun 3, 2016

The value of `title_path` is not altered when it is parsed by `Filesy…
…stemDataSource` class. More details in bug #88
@yosymfony

This comment has been minimized.

Copy link
Member

yosymfony commented Jun 3, 2016

Fixed. Now, the value of title_path attribute is not altered by FilesystemDataSource class. The issue related with the truncated title and the compound extensions has been fixed too.

For 2016-02-02-spress-2.1.1-released.md filename you'll get spress-2.1.1-released

yosymfony added a commit that referenced this issue Jun 3, 2016

@jjk-jacky

This comment has been minimized.

Copy link
Contributor

jjk-jacky commented Jun 3, 2016

Unfortunately this doesn't work for me, when it comes to keeping title_path as-is. That is, the title_path is indeed e.g. spress-2.1.1-released but it gets converted by the permalink generator.

Just pushed #90 with what I believe is the right fix.

@jjk-jacky

This comment has been minimized.

Copy link
Contributor

jjk-jacky commented Jun 3, 2016

(The issue wrt truncated titles however is fixed as expected, thanks.)

@yosymfony yosymfony closed this Jun 4, 2016

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