Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
419 views
in Plugins by
I was looking for a plugin that would make it easy to connect the Q2A to a CDN (Content Delivery Network) provider by automatically substituting a part of the URL for certain kinds of content with another string. (i.e. pulling/mirroring these items on the CDN and serving from there.)

Does this exist, is it in development or will it even be part of the core?

Although the present version of Q2A itself seems to be very lightweight, it might still be good to use a CDN for better user experience and not least for more acceptable search result ranking, especially if you run a Q2A with many images or if future versions increasingly use loads of javascript.

2 Answers

+2 votes
by

This could be done with a layer.

In a layer, $this->content contains the information that'll be used to create the html of the page. You can override the html core function of qa_html_theme_base and edit the $this->content['script'] , $this->content['css_src'] and other items in the $this->content array to do the find/replace you need for the CDN.

+1 vote
by
I think all the images are in the CSS, so you can just replace the URLs there. Michael's answer covers how to change the links for Javascript and CSS. Note, make sure that your CDN is gzipping those files, because some like Amazon don't gzip anything.
...