laktek / punch

A fun and easy way to build modern websites
http://laktek.github.com/punch
MIT License
1.17k stars 107 forks source link

How to get the static html generated in output folder to work without a server #89

Open joranovski opened 11 years ago

joranovski commented 11 years ago

Hi, but what if I want to just use the static HTML without a server, do I have to find and replace all urls from /about to /about/index.html? Because at the moment it links to /about but there is a folder /about created with and index.html within.

laktek commented 11 years ago

You can use punch generate (punch g) command to generate the static HTML. More details here - https://github.com/laktek/punch/wiki/Generating-a-Site

adrinux commented 11 years ago

That's not what joranovski is asking laktek. Currently Punch generates internal URLs as 'clean' URLs e.g. /about rather than /about/index.html – what that means is you need a web server capable of dealing with clean URLs in order for the output to be useful. For Apache 2 it's the option MultiViews that's required, without it internal links in Punch sites will fail (including menus).

So for truly static HTML that isn't served up with a server – an HTML based manual supplied with software, for instance (don't know what joranovski's use case is) – you need the link to be explicit "/about/index.html" or it just wont work (unless you manually fix all internal links, as suggested).

As far as I know Punch can't do this at the moment. Perhaps a flag to punch g is needed to output the full path, not a clean URL.

laktek commented 11 years ago

@joranovski @adrinux There isn't a built-in link helper in Punch, so you might either write a custom helper for that or just manually specify the URL.

joranovski commented 11 years ago

@laktek generating the static HTML was indeed not the problem with punch g @adrinux your right, generating the static HTML wasn't the problem, the routing without a server is. My usecase is that I made a UI styleguide and I want it to work without using a server. So only the static HTML for people to deal with. I'm not a programmer so I guess I have to roll up my sleeves and get my hands dirty ;)

adrinux commented 11 years ago

I think this needs to be a feature, it's a fairly obvious use case for a 'static' site generator =D

That said, if you've only a handful of links that need changed @joranovski you could just do them manually.

joranovski commented 11 years ago

@adrinux Yep I second that! :) Unfortunately there are more then a handful though :(