开发者

Best way to serve static resource (CSS, Images) with XDV in Plone

开发者 https://www.devze.com 2023-04-07 23:35 出处:网络
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

I have tried several ways to serve my static resources from Plone with XDV:

  1. Putting the CSS and images in the Custom folder - files are 404 not found
  2. 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
  3. Setting browser:resourceDirectory - 404 not found
  4. 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"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号