trvsdnn / frank

Static Site Non-Framework
http://github.com/blahed/frank
MIT License
413 stars 30 forks source link

Possible URL Helper #64

Open seangaffney opened 12 years ago

seangaffney commented 12 years ago

Really loving Frank so far, but trying to use it with a slightly larger site (around 20 pages) and would love a URL Helper of some sort, but didn't know if anyone had run into that before. It seems like it could be relatively simple to do based on file path, but I'm a bit of a n00b at Ruby... Any thoughts?

trvsdnn commented 12 years ago

I've considered this several times and tend to agree that it would be nice to have a few more helpers. I've been working on a new release as I find free time. It will certainly have some sort of url helper.

What exactly were you looking for? Something like rails: link_to or something a bit different?

seangaffney commented 12 years ago

A link_to would be great, but actually what might be more useful, IMO, would be an array object of all the pages/articles, etc. with all the meta data associated with them. That way in the template or layout, you can just loop through them and call whatever methods you need.

Something really similar to the get_post_sumaries method you're using in your site's helper would probably suffice. Then you could call article.permalink if you needed to.

What gets interesting is the one-off link, where you're not looping through. In that case I'm not sure how you would define the page you want in a link_to method or similar because there are no routes... I'll have to think on that one more!

trvsdnn commented 12 years ago

Ah yeah, I've been planning on doing this for a while too. I want to auto generate sitemaps, xml and html tree for development, this would require what you're talking about.

It's planned for sure.

phrozen commented 11 years ago

The ability to get a list of filenames and meta data specifying a directory from a helper would be awesome. For example a simple Blog would require a call to get_items('/posts') and you can iterate the last 3 or 5 and create your index page, even a categories menu or a tags cloud if you can access the yaml meta data. Frank will be as powerful as Nanoc or Jekyll without the need of complex compiling rules, as you can just work it out in the views with the helpers.

Eager to see v 2.0

trvsdnn commented 11 years ago

Yeah, the key to that I think is having a sitemap object... Which would also be helpful for generating a sitemap.