Allow free placement of posts. #579

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
4 participants
@trans
Contributor

trans commented Jun 17, 2012

This patch allows posts files to be placed anywhere, not just in _posts directory. Instead of looking only in _posts, it selects all files with a prefixed date in their name. So things will still work fine for sites that use _posts.

This is helpful in my case b/c my posts are being ported from my Gollum wiki. If I had to put them in _posts I'd have to do additional staging and copying of files. After thinking about it, I realized that there wasn't any real barrier to allowing Jekyll to handle the free placement of posts, and really this simplifies the design a bit in general which is always nice.

@parkr

This comment has been minimized.

Show comment Hide comment
@parkr

parkr Jun 18, 2012

Member

I think this steers Jekyll away from the opinionated trajectory it has historically taken. It requires posts to be in _posts and pages elsewhere.

This would also be confusing if I had a post in some directory with a permalink structure in my config file which was /:year/:month/:day/:title. This post would no longer get parsed into the directory in which it was placed, but in the directory which matches its date and title as configured. This lends itself to a messy and unorganized source.

If you're porting over another blog, all posts should go in your posts directory, as specified. Or, they can be pages.

I would recommend against applying this approach to the master gem.

Member

parkr commented Jun 18, 2012

I think this steers Jekyll away from the opinionated trajectory it has historically taken. It requires posts to be in _posts and pages elsewhere.

This would also be confusing if I had a post in some directory with a permalink structure in my config file which was /:year/:month/:day/:title. This post would no longer get parsed into the directory in which it was placed, but in the directory which matches its date and title as configured. This lends itself to a messy and unorganized source.

If you're porting over another blog, all posts should go in your posts directory, as specified. Or, they can be pages.

I would recommend against applying this approach to the master gem.

@trans

This comment has been minimized.

Show comment Hide comment
@trans

trans Jun 19, 2012

Contributor

I don't really think so. Just because people can do something doesn't mean they will do something. No one wants things to be messy so that just won't happen. Most people will just go right along using _posts regardless.

However, after some further thought I do think it would be better to add a config option for designating posts. And it can default to ./_posts.

Note that I'm not porting from another blog. I am actually dual purposing my Gollum wiki as a website. Which is really cool --and why I am working so hard on it. It means I can edit my posts and pages online and then with a single command update my website.

Contributor

trans commented Jun 19, 2012

I don't really think so. Just because people can do something doesn't mean they will do something. No one wants things to be messy so that just won't happen. Most people will just go right along using _posts regardless.

However, after some further thought I do think it would be better to add a config option for designating posts. And it can default to ./_posts.

Note that I'm not porting from another blog. I am actually dual purposing my Gollum wiki as a website. Which is really cool --and why I am working so hard on it. It means I can edit my posts and pages online and then with a single command update my website.

@parkr

This comment has been minimized.

Show comment Hide comment
@parkr

parkr Jun 19, 2012

Member

So are you suggesting we add a posts config option which defaults to ./_posts but can be switched to any other dir or false?

Member

parkr commented Jun 19, 2012

So are you suggesting we add a posts config option which defaults to ./_posts but can be switched to any other dir or false?

@trans

This comment has been minimized.

Show comment Hide comment
@trans

trans Jun 19, 2012

Contributor

or a glob. Yes.

Would false mean no posts?

Contributor

trans commented Jun 19, 2012

or a glob. Yes.

Would false mean no posts?

@parkr

This comment has been minimized.

Show comment Hide comment
@parkr

parkr Jun 19, 2012

Member

You meant the regex that matches posts? That could work.

false was originally "decentralized", but it was an off-the-cuff idea.

Member

parkr commented Jun 19, 2012

You meant the regex that matches posts? That could work.

false was originally "decentralized", but it was an off-the-cuff idea.

@trans

This comment has been minimized.

Show comment Hide comment
@trans

trans Jun 22, 2012

Contributor

So, after working on this I ended up not going as far as a glob/regexp config setting, but just being able to designate a custom posts directory.

Contributor

trans commented Jun 22, 2012

So, after working on this I ended up not going as far as a glob/regexp config setting, but just being able to designate a custom posts directory.

@tombell

This comment has been minimized.

Show comment Hide comment
@tombell

tombell Jun 22, 2012

Contributor

So what does this pull request actually do now, basically make the _posts directory configurable?

Contributor

tombell commented Jun 22, 2012

So what does this pull request actually do now, basically make the _posts directory configurable?

@trans

This comment has been minimized.

Show comment Hide comment
@trans

trans Jun 22, 2012

Contributor

Yes, but with one other difference. The posts directory could for instance be set to './' and it should still work, selecting out posts based on date prefix.

Note, I first tried to handle glob/regex but realized it would require more substantial alterations to the code than I felt comfortable attempting.

Contributor

trans commented Jun 22, 2012

Yes, but with one other difference. The posts directory could for instance be set to './' and it should still work, selecting out posts based on date prefix.

Note, I first tried to handle glob/regex but realized it would require more substantial alterations to the code than I felt comfortable attempting.

@trans

This comment has been minimized.

Show comment Hide comment
@trans

trans Mar 3, 2013

Contributor

I think I can live without this now. I have another idea. As I've mentioned before I would like to use a Gollum wiki to edit files and then use Jekyll to transforms it into a static site. So what I can do is clone the wiki to _wiki/ directory and have a Jekyll plug-in that preprocess the _wiki files to copy them into the correct places in _posts/ and _pages/. I think that would work just fine. See any problems with that approach? If it does work, then the only thing left is for Jekyll to support the full gamut of markup formats that Gollum does, and then it would be complete solution.

Contributor

trans commented Mar 3, 2013

I think I can live without this now. I have another idea. As I've mentioned before I would like to use a Gollum wiki to edit files and then use Jekyll to transforms it into a static site. So what I can do is clone the wiki to _wiki/ directory and have a Jekyll plug-in that preprocess the _wiki files to copy them into the correct places in _posts/ and _pages/. I think that would work just fine. See any problems with that approach? If it does work, then the only thing left is for Jekyll to support the full gamut of markup formats that Gollum does, and then it would be complete solution.

@trans trans closed this Mar 3, 2013

@jekyllbot 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.