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

Adding categories to blog. #254

Merged
merged 1 commit into from
Feb 9, 2017
Merged

Adding categories to blog. #254

merged 1 commit into from
Feb 9, 2017

Conversation

guusdk
Copy link
Contributor

@guusdk guusdk commented Feb 7, 2017

Currently, all blog posts are in the same default category 'misc'. This PR adds some other categories.

Certain posts could go into two categories, but I've yet to figure out how that's done. Comma-separated won't work, nor will adding the header twice.

Feel free to improve or add to this.

@tfar
Copy link
Contributor

tfar commented Feb 7, 2017

Many constraints in pelican are by design, so is that a post can only be in one category, see getpelican/pelican#350 . It can have more than one tag though.

@guusdk
Copy link
Contributor Author

guusdk commented Feb 7, 2017

Ah, ok. Should we move to tags then, or is a single category good enough?

@tfar
Copy link
Contributor

tfar commented Feb 7, 2017

I imagine there are use case for tags and categories. With tags you can have multiple and categories can build hierarchies I think. I'd go with only tags as we probably won't need a hierarchy in our blog posts and tags provide more flexibility.

@guusdk
Copy link
Contributor Author

guusdk commented Feb 7, 2017

Meh. Not sure how to proceed. When I switch 'categorie' for 'tags', then nothing visually changes (as compared to before I started this PR). When I use 'tag' (instead of 'tags'), Pelican throws this error during page generation:

Traceback (most recent call last):
  File "/usr/local/bin/pelican", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/pelican/__init__.py", line 465, in main
    pelican.run()
  File "/usr/local/lib/python2.7/dist-packages/pelican/__init__.py", line 179, in run
    p.generate_output(writer)
  File "/usr/local/lib/python2.7/dist-packages/pelican/generators.py", line 599, in generate_output
    self.generate_feeds(writer)
  File "/usr/local/lib/python2.7/dist-packages/pelican/generators.py", line 300, in generate_feeds
    self.settings['FEED_ALL_ATOM'])
  File "/usr/local/lib/python2.7/dist-packages/pelican/writers.py", line 123, in write_feed
    self._add_item_to_the_feed(feed, elements[i])
  File "/usr/local/lib/python2.7/dist-packages/pelican/writers.py", line 49, in _add_item_to_the_feed
    link = '%s/%s' % (self.site_url, item.url)
  File "/usr/local/lib/python2.7/dist-packages/pelican/contents.py", line 326, in url
    return self.get_url_setting('url')
  File "/usr/local/lib/python2.7/dist-packages/pelican/contents.py", line 188, in get_url_setting
    return self._expand_settings(key)
  File "/usr/local/lib/python2.7/dist-packages/pelican/contents.py", line 182, in _expand_settings
    return self.settings[fq_key].format(**self.url_format)
  File "/usr/local/lib/python2.7/dist-packages/pelican/contents.py", line 175, in url_format
    'tag': self.tag.slug if hasattr(self, 'tag') else '',
AttributeError: 'unicode' object has no attribute 'slug'

@tfar
Copy link
Contributor

tfar commented Feb 7, 2017

tags was probably correct. However, our theme doesn't use tags yet in the UI. If you take a look at https://github.com/xsf/xmpp.org/blob/master/xmpp.org-theme/templates/article.html it only mentions category. So it seems using tags would require further adjustments to our theme. Happy to go with categories instead then.

@guusdk
Copy link
Contributor Author

guusdk commented Feb 7, 2017

I tend to agree. Let's ping @bear (ping!) to see if switching from categories to tags in the theme is easy, but if not, let's go with categories.

@bear
Copy link
Contributor

bear commented Feb 9, 2017

it doesn't really matter which is used as long as the code that generates the feeds is also updated

@guusdk
Copy link
Contributor Author

guusdk commented Feb 9, 2017

Where is the code that updates the feed? Is that the same code as what @stpeter mentions is broken in xsf/xeps#1179 ?

@bear
Copy link
Contributor

bear commented Feb 9, 2017

probably - it may end up just being a config issue

@guusdk guusdk merged commit 34ef811 into xsf:master Feb 9, 2017
@guusdk
Copy link
Contributor Author

guusdk commented Feb 10, 2017

After the merge, categories popped up, and the single blog feed that we already had did not break. I'm declaring this a success. ;)

@guusdk guusdk deleted the blog-categories branch February 10, 2017 20:03
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

Successfully merging this pull request may close these issues.

3 participants