[DRAFT] Add tags/categories/archives pages plugins #870

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
10 participants
Member

ixti commented Mar 17, 2013

This is a start discussion pull request (real one will be re-factored and recreated as a separate one).

These plugins adds "dynamically" generated pages for archives (list posts by years), tags and categories. Usage example can be found on my blog (https://github.com/ixti/ixti.github.com/):

Follows up of #867.

@parkr parkr commented on the diff Mar 17, 2013

lib/jekyll/plugins/archives.rb
+ site_payload_without_archive_years.deep_merge({
+ 'site' => { 'archive_years' => years }
+ })
+ end
+ end
+ end
+
+ module InstanceMethods
+ def archives_config
+ @archives_config ||= Configuration.new(self.config['archives'] || {})
+ end
+ end
+ end
+
+
+ class Page
@parkr

parkr Mar 17, 2013

Owner

It'd be sweet if you could modify lib/jekyll/page.rb with any modifications necessary.

@parkr parkr commented on the diff Mar 17, 2013

lib/jekyll/plugins/archives.rb
+ class Configuration < OpenStruct
+ @@defaults = {
+ :dirname => 'archives',
+ :template => '_templates/archive',
+ :title => 'Archives of &laquo;{year}&raquo; year'
+ }
+
+ def initialize config = {}
+ super @@defaults.merge(config)
+
+ self.dirname = self.dirname.gsub(/^\/+|\/+$/, '')
+ end
+ end
+
+
+ module SitePatch
@parkr

parkr Mar 17, 2013

Owner

Could these patches be submitted against lib/jekyll/site.rb?

@ixti

ixti Mar 17, 2013

Member

All three plugins are similar to each other and of course if we are talking about including into core they can be simplified a lot. I just wanted to show off plugins themselves and what they provide. If their purpose is desired in jekyll core I'll spend some time on next weekend to refactor pull request to be more "close" to the final one. Just need to be sure that it won't get into conflict with generak policy of a party :D

Owner

parkr commented May 13, 2013

I'd love to see these added into the jekyll core. Having tags and categories without a direct means of showing them (short of looping through site posts and printing those which match a hard-coded category or tag name) seems to point to a missing feature to me.

@mattr-, what do you think?

Owner

mattr- commented May 13, 2013

I think this is awesome! 👍 🎉

Owner

mattr- commented May 13, 2013

And obviously they don't need to be plugins anymore. 😃

dragoon commented Jun 1, 2013

+1 for those pages, just one question, are your plugins somehow better than: https://github.com/recurser/jekyll-plugins ? How do they differ?

dragoon commented Jun 1, 2013

The plugin does not work for me, returns error:

Generating... error: undefined methoduses_relative_permalinks' for #<Jekyll:ArchivesPlugin:Page @year=2011>. Use --trace to view backtrace`

It seems that new Jekyll uses some method that plugin does not implement.

Member

ixti commented Jun 1, 2013

I don't know how they differ, they are just what I wrote for myself. This pull request is outdated of course, but it's just a draft (a stub if you will) so if general idea will be accepted - it will be completely refactored and new pull request will takeover this one. If you want to see these plugins working with current version of Jekyll grab them from my blog's sources directly: https://github.com/ixti/ixti.github.com/tree/source/_plugins

dragoon commented Jun 2, 2013

Hi, thanks for the reply. Actually I have already tried to use plugins form your blog sources, and they did not work either.
I had to add the following function to the Page class to fix them. Don't know if it's correct or not since I'm not a ruby programmer, just want to set up my blog :)

  def uses_relative_permalinks
      url && @dir != "" && site.config['relative_permalinks']
  end
Member

ixti commented Jun 2, 2013

@dragoon Oops. Sorry. I've committed a fix about a month ago but forgot to push. Your variant will work as expected, but it's just not needed - those generators will never generate relative links, so in my commit I just stubbed uses_realtive_permalinks with false.

Member

ixti commented Jun 2, 2013

So, if overall "feeling" is quiet "we want it", I'll prepare more realistic pull request.
/cc @parkr @mattr-

Owner

mattr- commented Jun 3, 2013

I think both @parkr and I said that we wanted this. Get crackin' on that PR! 😃

mattr- closed this Jun 3, 2013

Owner

parkr commented Jun 3, 2013

I do think they should be opt-in, but yeah I'd love to see this in the core!

ixti deleted the unknown repository branch Jun 3, 2013

What's the status of built-in tag support for Jekyll on Github?

I'm building a blog with multiple contributors who will primarily interact through Prose.io and cannot be building locally and pushing to Github every time they post something new. Tags are extremely important and useful for this site, but so far it only runs locally with plugins.

Owner

mattr- commented Jul 10, 2013

I'm afraid I'm a bit confused by your question. This pull request is about
adding archive pages for posts by year, tag, and/or category.

Jekyll supports tags for posts already. Tags are specified in the YAML
front matter for posts. You can find more info in the docs about
frontmatter
.

I thought Jekyll supported tags but Github Pages prevents the functionality that allows custom pages to be built for each tag because it disables custom plugins. See this blog post.

I thought this issue was about adding to the Jekyll core some basic tag pages functionality something.io/tag/ruby so when Github Pages upgraded Jekyll there would be built-in functionality for this.

Owner

mattr- commented Jul 10, 2013

That is exactly what this issue is about, yes. I thought you were talking
about tag functionality in general before. I'm sorry for misunderstanding
you. We're actually waiting on @ixti to submit what he thinks is the real
pull request for this.

On Wed, Jul 10, 2013 at 3:59 PM, Maya notifications@github.com wrote:

I thought Jekyll supported tags but Github Pages prevents the
functionality that allows custom pages to be built for each tag because it
disables custom plugins. See this blog posthttp://charliepark.org/tags-in-jekyll/
.

I thought this issue was about adding to the Jekyll core some basic tag
pages functionality something.io/tag/ruby so when Github Pages upgraded
Jekyll there would be built-in functionality for this.


Reply to this email directly or view it on GitHubhttps://github.com/mojombo/jekyll/pull/870#issuecomment-20772785
.

mayarichman referenced this pull request in youngist/clean-blog Jul 10, 2013

Closed

Need custom pages for each new tag used #6

No problem, I am looking forward to the continued development of this, right now I am plotting some hackish solutions.

Member

ixti commented Jul 11, 2013

Sorry for delay. Will submit a pull request this weekend.

Owner

mattr- commented Jul 11, 2013

No worries. Don't rush yourself unnecessarily. 😃

On Wed, Jul 10, 2013 at 7:47 PM, Aleksey V. Zapparov
notifications@github.com wrote:

Sorry for delay. Will submit a pull request this weekend.

Reply to this email directly or view it on GitHub:
mojombo#870 (comment)

Member

ixti commented Aug 28, 2013

I don't know when I'll find time to finish this proposal, so if there anybody wish to overtake it - I'll be glad. Feel free to use code from proposed plugins if you'll find them useful.

Nice man, I'll take a look at to help on this when I finish my current PR... (=

Owner

parkr commented Aug 14, 2014

If anyone watching this issue has the time or interest to create a category & page generator plugin, I'd love to take a look at it and possibly include it in core.

Member

alfredxing commented Aug 14, 2014

I would be willing to work on this. I have a question though—what is the difference between a 'tag' and a 'category', and how should Jekyll distinguish between the two?

Contributor

kleinfreund commented Aug 14, 2014

I'm not sure if there is a definitive difference, but if I were to guess: Only one category applies to a post, but a post can have multiple tags.

Member

alfredxing commented Aug 14, 2014

I guess I won't worry about it too much, since each Post object has a categories and a tags attribute. I'll just use those.

Contributor

kleinfreund commented Aug 14, 2014

What I said doesn't apply to Jekyll, of course. One post can indeed have multiple categories. But should it?

Member

alfredxing commented Aug 14, 2014

Wouldn't make a lot of sense to have multiple categories for one post (that's what tags are for, after all), but it's probably not in the scope of this issue to decide that. I'm sure there's a solid rationale behind the original decision.

alfredxing referenced this pull request Aug 15, 2014

Closed

Add archive functionality #2755

2 of 4 tasks complete

Categories are ordered and tags are not. Categories provide a tree like structure while tags link posts to a number of different ... sets.

jekyllbot locked and limited conversation to collaborators Feb 27, 2017

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