Assets: Support Github pages / http_prefix#197
Assets: Support Github pages / http_prefix#197lfdebrux merged 2 commits intoalphagov:masterfrom shippedcode:assets-support-http-prefix
Conversation
|
See also #219 |
|
Hi @odlp, sorry it took so long for us to get back to you! I'm reviewing these changes now so we can get them merged, they look great to me, only thing is that they need to be rebased. I can do this locally, but I'm unable to push to your pull request. Are you happy to do the rebase? Alternatively, you can give maintainers access to push changes, which might be easier for you! |
If the variable has already been set, then don't override it. This allows implementors to adjust for other settings (such as Middleman's http_prefix setting).
Using Sprockets helpers for asset URLs provides support for Middleman's http_prefix feature, which is useful for sites hosted on Github pages.
|
Thanks @lfdebrux - PR rebased |
|
You might also have some luck with using the relative links settings instead of |
|
This change has been included in release v3.2.0. I think there are some outstanding issues with You can now configure your Tech Docs Template (TDT) to build your documentation site to use relative links to pages and assets. Support for relative links and assets was introduced in pull request #291: Support sites deployed on paths other than "/" (by generating relative links). |
Hello 👋
This PR fixes asset URLs for sites built for Github pages using the default URL (like the API catalogue), in which paths are prefixed with the repo name.
Changes
$govuk-assets-pathto be overriden by implementorshttp_prefixsettingContext
For repo-specific Github pages, the site is deployed with the repo name prefixed in the path, e.g.
https://alphagov.github.io/api-catalogue/. We'd like to use Middleman'shttp_prefixoption to account for this path prefix, which will allow us to simplify and automate our build process.Our Middleman config looks like this:
With this PR all asset URLs correctly include the
/api-catalogue/prefix, and we can avoid using Middleman'sactivate :relative_assetsfeature.References
asset_path/image-urlhelpers!defaultto allow overrideshttp_prefixconfigued