Add your agreement to a Cloudflare Pages site
Add the HTML code of your agreement from TermsFeed Agreements & Policies to your Cloudflare Pages project as a page, or link its Live Link, then deploy. Cloudflare Pages has no policy feature of its own. The code puts the text on your own domain as a copy you replace after each change, and the Live Link always shows the text you saved last. Compare the Live Link and the HTML code in Live Link, HTML Code, or Download File.
Setup takes 3 steps and about 20 minutes. Before you start, activate your agreement in the TermsFeed app and get access to the Git repository the project deploys, or to the folder you upload.
Step 1: Add a page for the agreement to your project
Copy the code from the Copy HTML screen of your agreement in the TermsFeed app, under the tab of the language you publish, where the screen shows tabs. The code is a fragment for the content area of a page, with no <html>, <head>, or <body> element and no styles.
Create the page in the folder Cloudflare Pages serves. That folder is the static asset folder of your framework, such as public/, the build output folder of a hand-coded site, or the folder you upload. A static site generator such as Hugo or Astro takes the code in a page of its own content folder, which uses your layout.
Save a hand-coded page as privacy-policy.html, with the code inside the main content area of your layout. Cloudflare Pages serves the file at /privacy-policy and redirects /privacy-policy.html to that address, according to its serving rules. Build the page from the example page and the styles in Add a Legal Agreement to an HTML Website.
Step 2: Link the agreement from the footer of every page
Add the link to the footer template your pages share. Point it at your new page, or at the Live Link, which you copy with Copy beside the address under "Your Live Link" on the Install screen of the agreement.
Keep the Live Link behind an address on your own domain with a line in a _redirects file, in the same folder as your pages. A destination on another domain is allowed. This rule sends /terms to your Live Link with the status code 302, the default of Cloudflare Pages.
/terms YOUR_LIVE_LINK 302
Your footer then links both addresses on your own domain.
<footer>
<a href="/privacy-policy">Privacy Policy</a>
<a href="/terms">Terms and Conditions</a>
</footer>
Cloudflare Pages does not apply _redirects to a path a Pages Function serves, according to its redirects documentation. Keep the redirect path away from your function routes.
Step 3: Deploy the site
With Git integration, commit the page, the footer, and the _redirects file, and push to the production branch. A push to another branch builds a preview at branch.project.pages.dev, which you check before you merge.
With Direct Upload, build the site, open the project in the Cloudflare dashboard, and select Create a new deployment. Run npx wrangler pages deploy followed by the name of your build output folder to upload from the command line instead.
A deployment needs no cache purge. A cache rule you added to a custom domain keeps serving the old page, so narrow the rule and purge the page address, as the custom domains documentation describes.
How to check the policy on your live website
Wait until the deployment shows as complete in the Cloudflare dashboard.
- Open a private window and load your agreement page, such as
https://example.com/privacy-policy. The page shows the agreement in your site styles. - Load the same address with
.htmlat the end. The browser lands on the address without.html. - Click the footer link to the redirect path, such as
/terms. The Live Link opens on the TermsFeed app.
Common mistakes on Cloudflare Pages
- The page returns a 404 error. The file sits outside the folder Cloudflare Pages serves. Move it into the static asset folder or the build output folder, and deploy again.
- The redirect path returns a 404 error. The
_redirectsfile sits outside that same folder, or a Pages Function serves the path. Move the file, or pick a path no function serves. - The change shows on a preview but not on production. The commit went to a branch other than the production branch. Merge it into the production branch.
- The page shows old text. Copy the code again after you change the agreement, replace it in the file, and deploy again.
- The page has 2
<h1>headings. Your layout prints a page heading, and the code opens with its own<h1>. Delete one of the 2. - The footer link opens the termsfeed.com website. The agreement is switched off or not yet activated. Get it back with Policy Link Opens the TermsFeed Website Instead.
- The text looks different from the Live Link. Your site styles or your static site generator style the pasted text. Track down the cause with Pasted Agreement Looks Wrong on Your Website.