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

[feature request] use ARTICLE_{URL,SAVE_AS} for articles with only one (non-default) language #1404

Closed
azrdev opened this issue Jul 16, 2014 · 7 comments

Comments

@azrdev
Copy link

azrdev commented Jul 16, 2014

If there is only one version of an article, the url it is getting depends on his language:

  • if no lang is set, or lang == DEFAULT_LANG, ARTICLE_URL is used
  • if a lang is set that is different from DEFAULT_LANG, ARTICLE_LANG_URL is used

So assume my blog contains mostly articles in english, but some in another language… the latter would always have the lang attribute in the url, regardless of wether there exists an english version or not.

So I request to change the selection mechanism between ARTICLE_URL and ARTICLE_LANG_URL: Do not decide upon lang == DEFAULT_LANG, but if the article is the untranslated source.

Setting Translation: False in the article didn't help, maybe this whole thing is just a bug… you tell me :-)

@azrdev
Copy link
Author

azrdev commented Aug 5, 2014

Actually, this should be done by https://github.com/getpelican/pelican/blob/master/pelican/utils.py#L467 - or does that not affect the generated file names?

@avaris
Copy link
Member

avaris commented Aug 6, 2014

@azrdev: Not really. URL/SAVE_AS settings are decided on whether the article is in default language or not. And that is the expected behavior as stated in the docs [emphasis added]:

ARTICLE_LANG_URL [...] The URL to refer to an article which doesn’t use the default language.
...

If it's not a translation, can't you simply not give any lang metadata?

@azrdev
Copy link
Author

azrdev commented Aug 12, 2014

@avaris I can, now I do, and just create tags defining the language… seems to suit my needs, but as soon as I want to publish a translated version of some article, this will become inconsistent

@avaris
Copy link
Member

avaris commented Aug 12, 2014

I do see your point. However, the current behavior is also consistent in a way. Perhaps, this can be handled with a plugin? Forcing in_default_lang to True for non-translation articles should be easy enough to implement.

@CNBorn
Copy link

CNBorn commented Aug 24, 2014

EDITED: this approach is not working perfectly, it has a flaw that article.url is always returning an url that belongs 'article other than the default language'.

Forcing in_default_lang to True would be an easy-enough way to do this.

I'd propose a solution to this issue which are from my attempt in solving #1393

ARTICLE_LANG_SAVE_AS = ARTICLE_SAVE_AS

This helps pelican generated articles which other than default-lang will be put in normal path like other articles. (Enabling this feature usually means we are running a multi-lang blog)

@CNBorn
Copy link

CNBorn commented Aug 26, 2014

@azrdev I've implemented this feature in a pelican plugin - pelican-langcategory (which make articles can be browsed by their language, like categories), you can check it out to see if it can fit your needs.

@justinmayer
Copy link
Member

pelican-langcategory plugin addition merged. Thanks, Tyler!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants