Allow options.sources to contain the same date component multiple times #112

Merged
merged 1 commit into from Apr 6, 2013

Conversation

Projects
None yet
3 participants
@johndbritton
Contributor

johndbritton commented Apr 6, 2013

I organize my blog posts into folders by year, like so:

posts/
├── 2008
│   └── 2008-12-15-title.md
├── 2009
│   └── 2009-10-23-title.md
├── 2010
│   └── 2010-08-26-title.md
├── 2011
│   └── 2011-10-27-title.md
└── 2012
    └── 2012-10-29-title.md

In configuring middleman-blogs sources option, I expected support for file name globbing, but was unable to use the expected globing pattern:

blog.sources = "posts/*/:year-:month-:day-:title"

Adding globbing support seemed like it might be a fair bit of work based on the ways the sources option is used in the code, so I opted to add the ability to use date keywords multiple times in the sources option, like so:

blog.sources = "posts/:year/:year-:month-:day-:title"

tdreyno added a commit that referenced this pull request Apr 6, 2013

Merge pull request #112 from johndbritton/gsub-date
Allow options.sources to contain the same date component multiple times

@tdreyno tdreyno merged commit ad67955 into middleman:master Apr 6, 2013

1 check failed

default The Travis build failed
Details
@tdreyno

This comment has been minimized.

Show comment
Hide comment
@tdreyno

tdreyno Apr 6, 2013

Member

Nice! Thanks

Member

tdreyno commented Apr 6, 2013

Nice! Thanks

@johndbritton johndbritton deleted the johndbritton:gsub-date branch Apr 6, 2013

@johndbritton

This comment has been minimized.

Show comment
Hide comment
@johndbritton

johndbritton Apr 6, 2013

Contributor

🍻

Contributor

johndbritton commented Apr 6, 2013

🍻

@bhollis

This comment has been minimized.

Show comment
Hide comment
@bhollis

bhollis Apr 6, 2013

Member

Awesome. I like being explicit about the date components better than the globs, anyway.

Member

bhollis commented Apr 6, 2013

Awesome. I like being explicit about the date components better than the globs, anyway.

@johndbritton

This comment has been minimized.

Show comment
Hide comment
@johndbritton

johndbritton Apr 6, 2013

Contributor

I would really like to have glob support, or the ability to add multiple source directories. Another thing I tried was this:

blog.sources = []
(2009..2013).each do |year|
  blog.sources << "/posts/#{year}/:year-:month-:day-:title"
end

If I organize posts by category, there's no easy way to add the different directories as sources.

Contributor

johndbritton commented Apr 6, 2013

I would really like to have glob support, or the ability to add multiple source directories. Another thing I tried was this:

blog.sources = []
(2009..2013).each do |year|
  blog.sources << "/posts/#{year}/:year-:month-:day-:title"
end

If I organize posts by category, there's no easy way to add the different directories as sources.

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