![{{ article.image if article.image else 'article_image_placeholder' }}](/images/{{ article.image if article.image else 'article_image_placeholder' }}.jpg)
Closed tooh closed 6 months ago
Hi! Thanks for the message. Have you installed pelican-webassets
in the virtual environment? It's in the file requirements.txt
and it looks like that might be the problem. The files in the repository are updated from that point of view (I have some experimental changes locally but I've implemented them in the last few days)
Sorry, strike that, I can see that the code you copied comes from the webassets
package. Sorry. Let me investigate it.
So, as for the JINJA_ENVIRONMENT
, it should be set automatically by this https://github.com/pelican-plugins/webassets/blob/17faf0dcf94a165555109b58bd09fabb1decaa61/pelican/plugins/webassets/webassets.py#L36
Which version of Pelican are you using?
Thanks for your quick reaction.
Installed all the requirements from requirements.txt already.
I'm running latest version.
Your last comment triggered me and I checked my PLUGINS setting. Noticed webassets plugin was missing.
Added it and generator does not complain anymore about webassets environment missing.
Now I stumble upon the following error 👍
/Users/peter/Sites/bengal/templates/includes/share.html:1 in top-level │
│ template code │
│ │
│ ❱ 1 <span><a class="" href="{{article.share_post['twitter']}}" target="_blan │
│ 2 <span><a class="" href="{{article.share_post['linkedin']}}" target="_bla │
│ 3 <span><a class="" href="{{article.share_post['hacker-news']}}" target="_ │
│ 4 <span><a class="" href="{{article.share_post['email']}}" target="_blank" │
│ │
│ /usr/local/lib/python3.11/site-packages/jinja2/environment.py:466 in getitem │
│ │
│ 463 │ ) -> t.Union[t.Any, Undefined]: │
│ 464 │ │ """Get an item or attribute of an object but prefer the item. │
│ 465 │ │ try: │
│ ❱ 466 │ │ │ return obj[argument] │
│ 467 │ │ except (AttributeError, TypeError, LookupError): │
│ 468 │ │ │ if isinstance(argument, str): │
│ 469 │ │ │ │ try: │
╰──────────────────────────────────────────────────────────────────────────────╯
UndefinedError: 'pelican.contents.Article object' has no attribute 'share_post'
Does this need some configuration also ?
Oh that is another plugin that I installed (and also contributed to), namely share-post
https://github.com/pelican-plugins/share-post
It's up to you if you want to keep it, clearly. If you are not interested in buttons to share posts on social networks you can get rid of the relevant part in the template https://github.com/TheDigitalCatOnline/blog_source/blob/master/bengal/templates/article.html#L96
Same is true for all other plugins that I use e.g. series
https://github.com/TheDigitalCatOnline/blog_source/blob/master/bengal/templates/article.html#L104
All the highlighted lines here https://github.com/TheDigitalCatOnline/blog_source/blob/master/requirements.txt#L2-L7 are plugins, so you need either to install them or to get rid of the code in the template that uses them.
Let me know how it goes!
BTW you mentioned PLUGINS
: do you know that you can get rid of that variable and let Pelican discover plugins on its own? That the reason why share-post
doesn't work even though you installed it.
Well done!
Now, there is some automated machinery behind the scenes for things like images. Some of it is pretty old and Just Works but might be definitely done in a better way. Feel free to ask if it doesn't make sense or to change the code. Good luck!
Made some steps.
Now I'm puzzled by following code in index.html template
Yes, you probably don't have any series yet so series.items()
doesn't contain anything.
You can see some examples here:
series_info
.Again thanks.
Did not realize that series_info is a custom article metadata. :(
Added it to the article and working now.
No worries! You might want to wrap the whole block in {% if series.items() | length %}
(check the syntax) in case you want to keep it but don't have posts belonging to series yet.
Migration of theme finished for now.
http://blog.florijnconsultancy.nl/
Some cleaning up to do of the metadata of the articles and adding some article images and of course crediting your theme in the footer.
Thank you for your assistance!
You are very welcome! Thanks for the questions. Should you have further questions feel free to open a new issue.
Hello ,
I like your theme very much. I thought I give it a try by setting it up from the Bengal folder.
Basic setup was done without any problems but when generating the site I stumbled upon problems
Probably caused by missing config in JINJA_ENVIRONMENT
Should probably be:
After adding this to pelicanconf.py following error:
Traced it back to
On this one I'm stuck.
I know this has to do with the webassets module but I'm not very familiar with this.
I installed all the requirements.
Could it be that the pelicanconf.py that is published in your blog_source repo is not the one used for your live blog?
Would really appreciate your help.