Add snippets to the Cloudflare Pages

Seem that Cloudflare Pages has many new features, so not sure what is the most convenient way to add simple snippets on the Cloudflare Pages, as an example, right before the closing tag? E.g:

<script type="text/javascript" src="https://some.address/some.js"></script>
<div id="some-container" style="bottom: 90px; right: 20px;"></div>

Thanks,

The best place to add them would just be to include them into the source content that you are serving with Cloudflare pages.

2 Likes

I want to assign a custom domain for a few separate deployments and manage them from a single point. I am pretty sure it should be a serverless way. It seems like Workers should do the job, but it is a whole new area to cover for me.

If the domains are all being served from the same Pages project then workers are going to be the way forward. If they are from different projects then you can run something like sed in your build process. Very janky though

1 Like

This is exactly what I thought, but with Javascript I am weak, so to get something done, might take some extra time. Netlify however would be a great companion - but the limits and prices - they put there are just funny…I mostly need all that for translations which will get often updated.

Thanks for your response. I’ll add them straight to the source most likely. Any chance you are familiar with ‘Docusaurus maybe there some easy way’? I mostly ‘Crowndin’ API what going to be used.

Regards,