Best way to serve static resource (CSS, Images) with XDV in Plone
I have tried several ways to serve my static resources from Plone with XDV:
- Putting the CSS and images in the Custom folder - files are 404 not found
- Serving them from Apache and setting the Abs开发者_开发知识库olute URL Prefix in the XDV config - works, but any other relatively URL'd links (e.g. PDF files in my content) get prefixed as well and therefore are 404 not found
- Setting browser:resourceDirectory - 404 not found
- Setting cmf:registerDirectory - 404 not found
Any suggestions? I've turned the log level to DEBUG but this doesn't give me any clues.
You just need to put your css/js in the "static" directory and than use relative path in the index.html. Diazo/XDV will automagically remap relative paths.
Or you can also register a resourceDirectory in the usual way and than link files like so "++resource++myresourcedirid/my.css"
See an example here.
I managed to use static content served by Apache using mod_rewrite and the following rules in Apache Virtual Host configuration.
RewriteRule ^/css - [L]
RewriteRule ^/img - [L]
I have also used Giacomo method for specific Plone content style with the static
directory in my package which is linked in the "index.html" as "++resource++mypackage.theme/plone.css"
精彩评论