punch icon indicating copy to clipboard operation
punch copied to clipboard

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

Open joranovski opened this issue 12 years ago • 6 comments
trafficstars

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.

joranovski avatar Jun 28 '13 09:06 joranovski

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

laktek avatar Jul 01 '13 01:07 laktek

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.

adrinux avatar Jul 01 '13 10:07 adrinux

@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.

laktek avatar Jul 01 '13 13:07 laktek

@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 ;)

joranovski avatar Jul 02 '13 06:07 joranovski

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.

adrinux avatar Jul 02 '13 11:07 adrinux

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

joranovski avatar Jul 02 '13 12:07 joranovski