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

Why are CATEGORIES_URL and TAGS_URL gone? #1225

Closed
DonDebonair opened this issue Jan 10, 2014 · 9 comments
Closed

Why are CATEGORIES_URL and TAGS_URL gone? #1225

DonDebonair opened this issue Jan 10, 2014 · 9 comments

Comments

@DonDebonair
Copy link
Contributor

According to the 3.3.0 docs, TAGS_URL and CATEGORIES_URL exist and have defaults. However, according to the latest docs those settings don't exist anymore, and it's actually advised to put the urls hardcoded in the theme. That seems "dirty". Why has this changed?

@kylef
Copy link
Member

kylef commented Jan 10, 2014

That is not the case for me, can you confirm which version it says in the page title. Perhaps you have a cached version which isn't actually the latest.

screen shot 2014-01-10 at 09 59 44

@DonDebonair
Copy link
Contributor Author

I'm not seeing TAGS_URL (notice the plural) in your screenshot. It is there in the 3.3.0 version. I did notice, however, that CATEGORIES_URL (plural again) isn't in either version.

@justinmayer
Copy link
Member

See #1220 and 6264cf8 for more information.

I had not realized @saimn's notation about hardcoding when I merged that PR. I think this is something we should change. It doesn't make sense to me to have {TAGS|CATEGORIES}_SAVE_AS but not corresponding {TAGS|CATEGORIES}_URL settings. Not sure why hardcoding, or theme variable fragmentation, would be an appropriate solution.

@DonDebonair
Copy link
Contributor Author

If I may ask, why are there two settings for each URL? (ie. _URL and _SAVE_AS)?

@kylef
Copy link
Member

kylef commented Jan 10, 2014

@dandydev This is described in the documentation http://docs.getpelican.com/en/3.3.0/settings.html#url-settings

Example usage:

ARTICLE_URL = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'
ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'

This would save your articles in something like /posts/2011/Aug/07/sample-post/index.html, and the URL to this would be /posts/2011/Aug/07/sample-post/.

So one has index.html (save_as) and the actual URL used for linking does not.

@DonDebonair
Copy link
Contributor Author

Sorry, I wasn't looking very well, because it's right there in my own config :)
Anyways, shouldn't each "Direct Template" have an _URL as well?

Or maybe, considering that those URL's won't be dynamic, like the others, Pelican could implicitly set the _URL variables based on the _SAVE_AS variables, for use in templates.

Edit: never mind, you would probably want to be able to do something along the lines of

CATEGORIES_SAVE_AS = 'categories/index.html'
CATEGORIES_URL = 'categories'

@DonDebonair
Copy link
Contributor Author

Any update on this?

@DonDebonair
Copy link
Contributor Author

There's still no default for TAGS_URL, so I'm assuming this setting has been officially removed, but pelican-bootstrap3 still supports it, because I think hardcoding URLs is bad(tm).
Any word on this?

@justinmayer
Copy link
Member

If memory serves, these settings can be defined and then used in themes, but there's no need for them to be explicitly included in Pelican. If someone can make a contrary case, feel free to do so and I will re-open this issue.

sio added a commit to sio/pelican-alchemy that referenced this issue Oct 22, 2019
Non-hardcoded paths are not that simple.

Direct templates do not always have meaningful *_URL or even *_SAVE_AS
values. More than that, those variables are not even defined by default.
Therefore we need to replicate the logic used by Pelican itself when
calculating the path to direct template output.

Related:

- DIRECT_TEMPLATES handling by Pelican:
  https://github.com/getpelican/pelican/blob/01eb08c42b543450ee5e0e3de3854526708a6711/pelican/generators.py#L537-L550
- Pelican issue for "Why are CATEGORIES_URL and TAGS_URL gone?"
  getpelican/pelican#1225

Merges nairobilug#75
brodul pushed a commit to brodul/pelican-alchemy that referenced this issue May 22, 2020
Non-hardcoded paths are not that simple.

Direct templates do not always have meaningful *_URL or even *_SAVE_AS
values. More than that, those variables are not even defined by default.
Therefore we need to replicate the logic used by Pelican itself when
calculating the path to direct template output.

Related:

- DIRECT_TEMPLATES handling by Pelican:
  https://github.com/getpelican/pelican/blob/01eb08c42b543450ee5e0e3de3854526708a6711/pelican/generators.py#L537-L550
- Pelican issue for "Why are CATEGORIES_URL and TAGS_URL gone?"
  getpelican/pelican#1225

Merges nairobilug#75
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

3 participants