elegant
elegant copied to clipboard
More categories plugin support
Prerequisites
- [x] My Pull Request is filled against the
next
branch - [x] All commits in my Pull Request conform to Elegant Git commit Guidelines
Recommended Steps
- [x] My patch adds a new feature, therefore I have also added a help article about it
- [ ] My patch changes Elegant behavior, therefore I have updated the help article to reflect this change
- [ ] My commits are signed
Description
This PR includes support for having multiple categories in an article by means of more-categories
plugin and template changes in this PR.
Templates changes keep the behavior on deployments not using the plugin. Whenever the attribute article.categories
(added by more-categories
) is missing, it constructs single category list [article.category]
and proceeds.
Fixes #618: Since i had to update the keyword meta tag properly, this PR also fixes that issue. I could send a specific PR to fix just that if accepting this PR takes longer or it is not accepted.
Thank you @vokimon. I will review and merge the PR soon.
Thanks. I did some further changes required to pass all automatic checks. Waiting for your human review.
The invariant is: output should look identical if you just activate or desactivate more-categories plugin and they only look different when you define an article with multiple categories.
Regarding the keywords meta, i fixed my fix, by testing with and without the plugin and with and without tags, keywords, categories. I don't know whether the project has any kind of automated testing but it would be nice to automate those test cases.
Hi @vokimon , sorry for the delay.
I've tested it, but I couldn't get it to work (I even rebased against of top of next branch).
I've downloaded the more_categories plugin and tested both with category: tech, tips
and with categories: tech, tips
.
So I'm wondering that something might be missing with the actual status of pelican + Elegant.
Would you mind updating the PR (with rebase) so that I can attempt again testing it?
Thanks!
Traceback (most recent call last):
File "/home/iranzo/.bin/pelican", line 8, in <module>
sys.exit(main())
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/pelican/__init__.py", line 520, in main
autoreload(args)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/pelican/__init__.py", line 444, in autoreload
pelican.run()
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/pelican/__init__.py", line 125, in run
p.generate_output(writer)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/pelican/generators.py", line 686, in generate_output
self.generate_pages(writer)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/pelican/generators.py", line 595, in generate_pages
self.generate_articles(write)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/pelican/generators.py", line 469, in generate_articles
url=article.url, blog=True)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/pelican/writers.py", line 270, in write_file
override_output)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/pelican/writers.py", line 202, in _write_file
output = template.render(localcontext)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/iranzo/.local/venvs/pelican/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/home/iranzo/www/themes/elegant/templates/article.html", line 1, in top-level template code
{% extends 'base.html' %}
File "/home/iranzo/www/themes/elegant/templates/base.html", line 50, in top-level template code
{% block meta_tags_in_head %}
File "/home/iranzo/www/themes/elegant/templates/article.html", line 23, in block "meta_tags_in_head"
) | join(', ') }}" />
TypeError: can only concatenate list (not "str") to list
My traceback :-)
One year and two months after the PR it's hard for me to recall the intent of the code, but taking a look at it i would say that categories
wasn't to be a comma separated string but a yaml list.
categories:
- cat1
- cat2
- dog
I don't recall if at any point of the metadata reading, comma separated strings were turn into a list as well. In such case, it looks like it is not happening. All my personal uses of the extension use yaml lists.
Hi, With:
I'm still getting the traceback: