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

How to reuse permalinks on a listing ? #27

Closed MoOx closed 10 years ago

MoOx commented 10 years ago

I want to achieve a simple thing: create a index of my blog posts. This involves a list of posts metas (done by hand), but I'm missing url builded by this plugins. I take a look to the source, it seems it'll not be easy to reuse the code/retrieve builded urls. Am I missing something ?

hariadi commented 10 years ago

Are you mean generating sitemap?

MoOx commented 10 years ago

Not really. I want to build a page that list all my blog posts on my website, using handlebars loop.

MoOx commented 10 years ago

I just want to achieve that http://jekyllrb.com/docs/posts/#displaying_an_index_of_posts (as you can see I'm trying to migrate from jekyll to assemble :) )

MoOx commented 10 years ago

I'm reading that part of the doc, it seems I've to tag my posts pages & I should be able to do what I want. http://assemble.io/docs/Pages-Collections.html. I'll take a look asap if I've permalinks available somewhere.

doowb commented 10 years ago

With the latest commit, you should be able to loop over the pages collection like the documentation suggests, and use the relative helper to find the relative link between the current page.dest and each this.dest within your pages loop.

We might have to push this latest commit to npm before it'll work exactly right and I think there's another issue that had been open with a code example that I'll try to find.

MoOx commented 10 years ago

Cool. Thanks for your work !

doowb commented 10 years ago

@MoOx take a look at this example page.

The highlighted lines show how to loop over the pages collection and build relative links. This is done in markdown, so you'll have to change it to work with your html, but it's a good example.

MoOx commented 10 years ago

Nice ! Is there a way to only loop on a certain bundle of pages ? eg loop on "posts" & not all my pages ?

jonschlinkert commented 10 years ago

@MoOx, here is an example of using {{is}} for building navigation. There are a few ways to do this, but is a good starting point.

MoOx commented 10 years ago

@jonschlinkert your link give me a 404 :s

jonschlinkert commented 10 years ago

Sorry about that! It's correct now. without even thinking I just updated the dir structure for the templates. I need to remember that issues are linked to those from time to time!

MoOx commented 10 years ago

Works llike a charm. Thanks !