eudicots / Cactus

Static site generator for designers. Uses Python and Django templates.
BSD 3-Clause "New" or "Revised" License
3.46k stars 314 forks source link

Page and static prefix support proposal for koenbok/Cactus#177 #209

Closed kartoch closed 5 years ago

kartoch commented 8 years ago
krallin commented 8 years ago

A few notes (sorry, I have a lot on the side, so not able to be as reactive as I wish to be):

Thanks!

kartoch commented 8 years ago

Can you briefly explain the use case for this? Not that I don't believe it's useful, but I just want to make sure there aren't other changes we should be making.

I want to drop my files in http://www.mysite.com/subdir/

There is still a problem: sitemap is generated based on site-url, but only uses the main domain name and does not include the prefix.

This might break for external URLs (which are returned absolute and would still get the prefix).

Ya, that a problem. One (weak) solution is to use normal URL instead of static and url tags.

There's a bit of duplicate logic here, would it make sense to move it to _get_url? This would also let you solve the problem of external URLs more easily. Can we get some tests added? Both in cases where page-prefix and static-prefix are set? We might also want some docs. Historically we've been bad at this, but no one will find this feature unless it's at least somewhere in the README.

The final submission will be factorized / optimized, I'm just want feedbacks first to see if mu proposal is interesting and correct.

kartoch commented 8 years ago

Tests are working, your turn.

kartoch commented 8 years ago

@afrigeri the '/static' pattern is used as-is in the Cactus source, see 'template_tags.py' . My proposal is just to add a prefix to it, hence having something like '/my-prefix/static'.

geomblog commented 6 years ago

I opened a separate issue, but maybe it's better as a comment here. I used this patch because I had the same use-case. And it works fine. However, I can't do testing any more, because the files in .build all have the site-path encoded in whereas for local testing '/static/...' urls suffice. It's almost as if one needs a 'deploy' option like with S3, but for this purpose. Or have a way to only do the rewrite for the final build instead of testing?

kartoch commented 5 years ago

largely outdated