I think you can set
media_url: /path/to/your/site/subfolder/media
in your site.yaml and it will generate correct absolute path
By the way, you don't need to call media_url as method of site object. Just call
it this way {{media_url('some_url')}}. This is shorter to write, and this will
probably change in future, media_url wouldn't be a method of site object.
--
Grygoriy Fuchedzhy
For this, I use two configuration file: one for development and another
one for production (the later extends the former).
integration branch of hyde supports plugins defined at your site, so you can do
something like this:
add to plugins list in site.yaml
- plugins.CustomPlugin
then add plugins.py with something like this:
> from hyde.plugin import Plugin
> from hyde.site import Resource
>
> class CustomPlugin(Plugin):
> def begin_site(self):
> def media_url(self, path):
> return '/'.join(self.relative_path.count('/') * ['..'] + [self.site.media_url(path)])
> Resource.media_url = media_url
After this you can call {{resource.media_url("some_url")}} which is clearer.
P.S. Didn't test this code, but I think you've got an idea.
By the way, this is one more example, when media_url should got more context
then just site object.
--
Grygoriy Fuchedzhy