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

category_meta plugin is broken with Pelican 3.7.1 #855

Open
jaredandrews opened this Issue Feb 8, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@jaredandrews
Copy link

jaredandrews commented Feb 8, 2017

Hi everyone,

The category_meta plugin is broken in Pelican 3.7.1.

There are two problems causing issues. I have documented them and the "solutions" for these issues in this repo: https://github.com/jaredandrews/pelican_category_meta_problems

#846 references a part of this issue but I figured I could help out by providing more thorough documentation.

Issue 1: category_meta fails to do anything when the index file doesn't have a date
When I build the site with make html I see:

ERROR: Skipping category/index.md: could not find information about 'date'
ERROR: No category assignment for ~/pelican_category_meta_problems/content/category/post.md (~/pelican_category_meta_problems/content/category/post.md)

When I go to the category.html page the category.description variable provided by category_meta is empty.

Solution: Added a date to my category index file. This is neither specified by the documentation of category_meta nor does it really make sense. I suspect at one point Pelican did not require articles it reads to have dates.

You can see this issue in action by checking out jaredandrews/pelican_category_meta_problems@859278b

Issue 2: category_meta causes an AttributeError
After adding a date to the category index file and running make html I get the following:

CRITICAL: AttributeError: can't set attribute

This is caused by line 73 in category_meta.py:

category.slug = slug

Presumably category.slug could be changed in previous versions of Pelican.

You can see this issue in action by checking out jaredandrews/pelican_category_meta_problems@62dac28

If I remove line 73 from category_meta.py, make html works and the category description is is provided by the plugin.

You can see the plugin working again by checking out jaredandrews/pelican_category_meta_problems@a99f9a6

I'm not 100% certain of the author of category_meta's intentions, but presumably removing this line to "fix" the plugin causes a loss of functionality.

I would love to help fix this issue but I am not very familiar with the Pelican code base nor am I 100% sure with what the category_meta author was trying to achieve with the slug assignment above.

Is there a way to reassign a categories slug in Pelican 3.7.1?

I don't know the answer to this question nor do I know why this would have been removed. I hope this documentation can help someone who does know :)

@jaredandrews

This comment has been minimized.

Copy link
Author

jaredandrews commented Feb 8, 2017

I just discovered that replacing category.slug = slug with category._slug = slug fixes the issue. My understanding is that a variable prefixed with _ is supposed to be private so this change would be considered improper, yea?

@manugarri

This comment has been minimized.

Copy link

manugarri commented Oct 8, 2017

@jaredandrews did you figure out a fix for this? I am not sure the Meta category plugin is actively maintained. Maybe submit a PR with your fix?

@manugarri manugarri referenced this issue Oct 8, 2017

Closed

Add author box #2

@jaredandrews

This comment has been minimized.

Copy link
Author

jaredandrews commented Dec 4, 2017

Hey @manugarri, thanks for the response. Sorry for the delay in getting back to you, I just discovered I had my GitHub notifications turned off!

Technically speaking, a fix exists in jaredandrews/pelican_category_meta_problems@a99f9a6

I'm just not totally confident that the changes I made don't break something else the original author of the plugin intended it to do (as outlined in my original post above).

For what it's worth, I have been using my modified version of the plugin on my website for almost nine months and it has been working great for my purposes. You can see the plugin in action along with a description of what I am using it for here: https://jaredandrews.com/making-this-site-part-4-category-template.html

I would be happy to clean up the code and make a pull request if that sounds good to you.

Thanks!

@justinmayer

This comment has been minimized.

Copy link
Member

justinmayer commented Mar 23, 2018

Hi @jaredandrews / @manugarri. Would you like to submit a PR to address the issue(s) you discussed here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment