pelican-plugins / series Goto Github PK
View Code? Open in Web Editor NEWSeries is a Pelican plugin that joins multiple posts into a series
Series is a Pelican plugin that joins multiple posts into a series
Started using series plugin.
I encounter this error. My skills in python are not sufficient to understand the cause
/Users/peter/.local/lib/python3.9/site-packages/pelican/plugins/series/series.py:42 in │
│ aggregate_series │
│ │
│ 39 │ │ forced_order_articles.sort(key=itemgetter("index")) │
│ 40 │ │ │
│ 41 │ │ date_order_articles = [i for i in series_articles if i["index"] == 0] │
│ ❱ 42 │ │ date_order_articles.sort(key=itemgetter("date")) │
│ 43 │ │ │
│ 44 │ │ all_articles = forced_order_articles + date_order_articles │
│ 45 │ │ ordered_articles = [i["content"] for i in all_articles] │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: can't compare offset-naive and offset-aware datetimes
Is there a way to manually index the articles in a series using metadata fields in the markdown?
I've been trying to figure out a way to do custom ordering so I can have a next and previous button on the article page and have been struggling with default Pelican. I found this plugin and it is perfect for next and previous buttons, but it seems like it also will only order based on date.
An example case I am thinking of could go like this:
I am making a tutorial series or something of the sort. The work I'm doing is such that I'm making the tutorials a bit out of order. Or maybe I want to go back and add a tutorial in the middle at a later date. So, what I want to do is be able to put an attribute in the meta-data like "series_part" where I can explicitly list part 1, 2, 3, and so on, independent of date posted.
Is this something that is possible and/or would this be something that would be reasonable to add?
If you have an article that has both a Series tag as well as the Status: draft
set, and the article.html
makes use of e.g. article.series.all
, pelican will throw an error:
UndefinedError: 'str object' has no attribute 'all'
That happens even though I used the {% if article.series %}
that is used in the README.
That is mostly a documentation problem in my opinion, as you could just change the template to {% if article.series and article.series.all %}
or any variation of that.
This is similar to #18, although the specifics I'm seeing are slightly different than what was described there.
I've got a draft article with my first series in it.. and just added series support to my theme. My pelicanconf.py
defines DEFAULT_METADATA of "status": "published"
for development purposes, and publishconf.py
sets that default to draft
. This is the setup I use so that the devserver will show me draft articles as they will appear once published. My uses of pelican-series
worked fine in this setup until I tried to do a producton publish of a new article, while the unfinished series article is still in drafts.
When Pelican's make publish
target hits that draft article, it fails. The first encountered error is a reference to article.series.previous.url
:
UndefinedError: 'str object' has no attribute 'previous'
The error comes from this bit of template in my article.html
:
{% if article.series.previous is not none %}
<a class="series-footer text-muted"
href="{{ SITEURL }}/{{ article.series.previous.url }}">
<i class="fa fa-angles-left"></i>
Previous Article
</a>
{% else %}
<i class="fa fa-angles-left"></i>
Previous Article
{% endif %}
That block is itself wrapped in an if to check whether the article is part of a series:
{% if SHOW_SERIES and article.series is defined %}
The draft in question is the first and only article in the series, so article.series.next
and article.series.previous
should both be None
. I've done some strategic commenting-out of bits of the template and inserting values as comments to determine that article.series.previous
actually references article.series.name
in a draft, rather than article.series.all_previous[-1]
, as it does when the article is published.
Oddly, article.series.index
and article.series.name
both seem to be empty string when the document is a draft, but work as expected when the document is published.
Relevant software version info from my virtualenv:
% python --version
Python 3.10.9
% pip freeze
blinker==1.5
commonmark==0.9.1
docutils==0.19
feedgenerator==2.0.0
Jinja2==3.1.2
MarkupSafe==2.1.1
pelican==4.8.0
pelican-i18n-subsites==0.9.0
pelican-series==2.1.0
pelican-youtube==0.2.1
Pygments==2.13.0
python-dateutil==2.8.2
pytz==2022.7
rich==13.0.0
six==1.16.0
smartypants==2.0.1
typogrify==2.0.7
Unidecode==1.3.6
The installation instructions in the README don't mention loading the plugin.
Basically what it says; it'd be neat to be able to have a paginated (if using such) index of all articles in each series as an option, especially ordered by series index value. Right now, pagination of articles in an index is dictated only by the sort order across the whole site, so if you want articles listing normally in reverse chronological order, you can't then have a chronological listing only for specific categories or series.
I'd like a feature to generate an index listing per-series, likely by default at /series/{{ series.name }}.html
and organized in series order.
When trying to reference series
in a template page in TEMPLATE_PAGES
, I get the jinja error
UndefinedError: 'series' is undefined
I don't see a test for this either.
This probably needs to go under all_generators_finalized
, since article_generator_finalized
only processes article generators, not page generators.
Unfortunately the merge of PR #35 fails and I have no clue how to fix it as there is a lot of automation going on. Can you please help? The build works locally, I'm actually using it for my blog.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.