Publii icon indicating copy to clipboard operation
Publii copied to clipboard

Add support for CDNs

Open dziudek opened this issue 5 years ago • 10 comments

ref. https://github.com/GetPublii/Publii/issues/271#issuecomment-454391795

We need to add an option to specify a domain for the assets (it would be good to specify separate domains for theme assets and media assets).

dziudek avatar Jan 15 '19 13:01 dziudek

No, the relative path needed to enable netlify cdn.

And I am using cdn for static assets (fonts, images, svgs, js, css ). And I don't enable them manually, it's automatic in netlify ( if you choose proper settings ).

vivek-kumar-poddar avatar Mar 27 '19 13:03 vivek-kumar-poddar

Here is the Ghost storage adapter I've used for Cloudinary which worked perfectly for my needs. Perhaps there's some value to be had looking at that as a starting point. https://github.com/eexit/ghost-storage-cloudinary

docherty avatar Nov 21 '19 11:11 docherty

When can we expect support for CDN?

OR alternatively can developers please provide or tell me how to modify static assets (js/CSS/fonts/images) URL path to custom CDN path.

Example: After sites rendering; the path of a CSS file is: domain.com/assets/css/style.css

To enable CDN, I need to change it to: cdn.domain.com/assets/css/style.css

BUT it is necessary that there is "style.css" in the following directory -> domain.com/assets/css/

So basically, I just need help to rewrite the URL for static assets after or while rendering.

I want to transfer 3 of my WordPress websites to publii, but I can not afford to sacrifice on website speed, and without CDN, I don't find any mean to keep all my site performant.

Please please help me with this.

Thanks!

designgrande avatar Dec 11 '19 03:12 designgrande

Any help, please

designgrande avatar Dec 17 '19 00:12 designgrande

@designgrande - at this moment the only way to make it working is to use @rendering.previewMode global variable to create custom CSS/JS paths when website is rendered. So if previewMode is active - you render CSS/JS paths in the old way, but for the non-preview mode you use custom paths.

dziudek avatar Dec 17 '19 08:12 dziudek

@dziudek Hi, I understood how to do it for CSS and JS (also thanks to docs: https://getpublii.com/dev/renderer-global-variable/) but how to achieve the same with images?

designgrande avatar Dec 26 '19 17:12 designgrande

Any update on CDN implementation - I think it was requested back in Jan 2019. Not enforcing or anything, just that every other issue is resolved within months.

Regards.

gadgetraja avatar Mar 24 '20 07:03 gadgetraja

Is there any improvement on this. Because SEO site checkers give warnings about it. If not images then at least there should be an option to load most common CSS/JS files from a CDN.

Suleman-Elahi avatar Aug 15 '21 13:08 Suleman-Elahi

I think that this problem is still, applicable to this day. If I want to add my own domain to GitHub pages I need to change all the files manually. adding a check box for a domain will be amazing when pushing to Github pages because it will mess up the website

it won't find the CSS...

thefourcraft avatar Aug 24 '22 06:08 thefourcraft

Here is the Ghost storage adapter I've used for Cloudinary which worked perfectly for my needs. Perhaps there's some value to be had looking at that as a starting point. https://github.com/eexit/ghost-storage-cloudinary

Ghost also has a an official Cloudinary integration: https://ghost.org/integrations/cloudinary/

candideu avatar Aug 31 '22 21:08 candideu