itafroma / jekyll-archive Goto Github PK
View Code? Open in Web Editor NEWJekyll plugin to create a set of archive pages.
License: MIT License
Jekyll plugin to create a set of archive pages.
License: MIT License
Currently, JAG replaces page.date
with a hash containing a value and a pattern. This should be filled with what Jekyll users expect: just the date.
Anything JAG-specific should be contained in its own variable: let's use page.archive
.
Hello again,
Not sure if this is the right place to make feature request, but is it possible to extend this plugin so that archive pages can have links to their previous and next day/month/year? Or is there an easy way to do this with Jekyll/Liquid already without adapting this plugin?
(Forgive me, but I am new to Jekyll, and just learning how it all works and understanding what's possible. I also programme in so much as I copy and paste bits of code, cross my fingers and hoping that something works!)
Thanks!
Paul
According to Jekyll's pagination docs, paginator.posts
should contain "a list of posts for the current page". However, JAG's paginator.posts
contains a list of pages generated for the current page's archive type.
This should be corrected, but there is still value to having the list of archive pages generated. These should be added to a new attribute, paginator.pages
.
Jekyll's paginator is a good starting point, but it's clear it's designed for its specific use case and shows some cracks when translating it to JAG's use case (see #2, #5, and #6). Continuing to override paginator
on archive layout pages is going to be confusing since JAG's paginator doesn't work exactly like Jekyll's paginator.
In keeping with #4, JAG's pager should be moved to within the page.archive
Liquid object and named page.archive.pager
.
I figured out the issue with my archive pagination: I had paginate: 10
set in my _config.yml file. Not only does thus mean pagination advances by this value rather than +/- 1, but information about archives immediately proceeding/following is incorrect as well.
Shouldn’t JAG ignore this value?
Hello Mark,
One of the shortcomings of Jekyll is that it doesn’t generate archive pages by default, leaving a lot of blogs with URLs that generate 404s. Your plugin has thankfully plugged that hole!
However, using the provided example template and config values, page.title
is not generated for archive pages. I note that on your own site you create a datename
variable (sourced from page.date.pattern
), and that you don't have a title set up in your _config.yml. Is that the recommended use?
Thanks,
Paul
Splitting off from #3, should the path and title keys only support Jekyll's permalink tokens? There's not a lot of flexibility with them, but they are what everyone knows. Alternatively, it'd be cool to just support whatever Ruby's DateTime.strftime supports. Maybe do both?
Currently, JAG hard defines three archive "types": all posts filtered by day, all posts filtered by month, and all posts filtered by year. For each archive type, it also hard defines the path and title.
This configuration probably covers 80% of the use-cases for archives, but it'd be cool if there was some more flexibility. I mentioned in #1 for example that on my website, the default path pattern suits me (YYYY/MM/DD
), but I wanted a different date pattern for the archive titles (Month D, YYYY
).
I think it'll require a new configuration schema to do this properly. The current archive
nested mapping will be replaced with a collection of sequences, which each sequence corresponding to an archive type. To give an example, the current hardcoded archive types would be defined like so:
archive:
- layout: archive
path: /blog/:year/:month/:day
title: Blog archive - :year/:month/:day
exclude: ['projects']
- layout: archive
path: /blog/:year/:month
title: Blog archive - :year/:month
exclude: ['projects']
- layout: archive
path: /blog/:year
title: Blog archive - :year
exclude: ['projects']
(The top three could/should be pre-defined as defaults so you wouldn't have to type all that if you just want the 80% use case)
You could then customize each type however you'd like: want a different title, but just for the yearly archives? No problem!
Taking this one step farther, this new schema should allow for arbitrary collections of posts, not just all posts with a simple exclude filter. So exclude
will become a nested mapping, with two keys—categories
and tags
—and will gain a complementary include
nesting mapping with the same keys:
archive:
- layout: archive
path: /blog/:year/:month/:day
title: Blog archive - :year/:month/:day
exclude:
tags: ['hidden']
include:
categories: ['blog']
- layout: archive
path: /blog/:year/:month
title: Blog archive - :year/:month
exclude:
tags: ['hidden']
include:
categories: ['blog']
- layout: archive
path: /blog/:year
title: Blog archive - :year
exclude:
tags: ['hidden']
include:
categories: ['blog']
- layout: archive
path: /projects/:year
title: Project archive - :year
include:
categories: ['projects']
The logic with the include
and exclude
keys would be the following:
include
is missing, all posts will be included.include
is present, only posts matching the include criteria will be included.exclude
is resolved after include
.For example, this would mean only posts in the blog
category that do not have the hidden
tag will be present in the archive type:
include:
categories: ['blog']
exclude:
tags: ['hidden']
Open question: should the path and title keys only support Jekyll's permalink tokens? There's not a lot of flexibility with them, but they are what everyone knows. Alternatively, it'd be cool to just support whatever Ruby's DateTime.strftime supports. Maybe do both?
Splitting off from #3, JAG should have more robust filtering now that you can have more than one archive. The idea is that exclude
will become a nested mapping, with two keys—categories
and tags
—and will gain a complementary include
nesting mapping with the same keys:
archive:
- layout: archive
path: /blog/:year/:month/:day
title: Blog archive - :year/:month/:day
exclude:
tags: ['hidden']
include:
categories: ['blog']
- layout: archive
path: /blog/:year/:month
title: Blog archive - :year/:month
exclude:
tags: ['hidden']
include:
categories: ['blog']
- layout: archive
path: /blog/:year
title: Blog archive - :year
exclude:
tags: ['hidden']
include:
categories: ['blog']
- layout: archive
path: /projects/:year
title: Project archive - :year
include:
categories: ['projects']
The logic with the include
and exclude
keys would be the following:
include
is missing, all posts will be included.include
is present, only posts matching the include criteria will be included.exclude
is resolved after include
.For example, this would mean only posts in the blog
category that do not have the hidden
tag will be present in the archive type:
include:
categories: ['blog']
exclude:
tags: ['hidden']
In #7, JAG's override of paginator
was deprecated in favor of page.archive.paginator
. This should be removed entirely at a later date.
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.