assemble / grunt-assemble-permalinks

Permalinks middleware for Assemble, the static site generator for Grunt.js and Yeoman. This plugin enables powerful and configurable URI replacement patterns, presets, uses Moment.js for parsing dates, and much more.
MIT License
43 stars 11 forks source link

Permalinks for Assemble v0.6.0 #60

Closed Melindrea closed 9 years ago

Melindrea commented 9 years ago

How would I go about using this middleware (or get the same effect) in v0.6? I'm not needing anything too advanced, just standard 'pretty links' and some subfolders. That is:

/pages
    -- index => /
    -- colophone => /colophone
    /stories
    -- index => /stories
    -- story-1 => /stories/story-1
jonschlinkert commented 9 years ago

Coincidentally I just started working on updating this for assemble v0.6.0. I'll update when it's ready

Melindrea commented 9 years ago

Thanks, sounds good =)

I'll work on other things, and if the permalinks aren't done in time for my next version, I should hopefully be able to juryrig an ugly placeholder!

jonschlinkert commented 9 years ago

lol, I know the feeling. I'm in a similar position so I want to get this done!

Melindrea commented 9 years ago

If there's any particular bit I can help with, let me know

jonschlinkert commented 9 years ago

Awesome thanks. Any feedback on what features you want to see would be great. I haven't decide how much I'm going to stick to the original feature set

Melindrea commented 9 years ago

I'll think over that some. I managed to get the most naive implementation possible for my current set of pages, but my real website will also need a blog with categories/tags/etc.

Naive implementation:

.pipe(rename(function (path) {

            if (path.basename !== 'index') {
                path.dirname += '/' + path.basename;
                path.basename = 'index';
            } else {
                path.dirname = '.';
            }
        }))

Aka, if it's index it is in the same folder, if not it gets moved to basename/index.html

I'm not renaming the extension, since I use gulp-extname (which I kind-of figure I'll want to keep later as well).

jonschlinkert commented 9 years ago

Thanks, that helps!

Sent from my iPhone

On Mar 10, 2015, at 6:25 PM, Marie Hogebrandt notifications@github.com wrote:

I'll think over that some. I managed to get the most naive implementation possible for my current set of pages, but my real website will also need a blog with categories/tags/etc.

Naive implementation:

.pipe(rename(function (path) {

        if (path.basename !== 'index') {
            path.dirname += '/' + path.basename;
            path.basename = 'index';
        } else {
            path.dirname = '.';
        }
    }))

Aka, if it's index it is in the same folder, if not it gets moved to basename/index.html

I'm not renaming the extension, since I use gulp-extname (which I kind-of figure I'll want to keep later as well).

— Reply to this email directly or view it on GitHub.

Melindrea commented 9 years ago

And just confirmed that it works with at least three levels of subfolders, and with a page called stories.md alongside the folder stories, nesting it properly.

Melindrea commented 9 years ago

Okay, so disregard this ATM. It printed out the paths correctly ... but it apparently didn't like the idea of giving them the right content!

So, here's the scoop:

When I change the basename of the file, it looses its' layout, though it appears like it will pick up other layouts if they match the basename. That is, I have a specific layout for my index.md file, and if I rename the other files to some-folder/index.html they pick up the index layout. If I rename them some-folder/default.html it looses the layout.

jonschlinkert commented 9 years ago

being implemented as a middleware in 0.6