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 serves the files you build or upload and 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.

Cloudflare Pages publishes a project in one of 2 ways, chosen when you create the project, and the project keeps that way for good. With Git integration, a push to the production branch deploys the site. With Direct Upload, you upload the built files from the dashboard or with Wrangler. Compare the Live Link and the HTML code in Live Link, HTML Code, or Download File.

Setup takes 4 steps and about 20 minutes. Have these ready first.

  1. Activate your agreement in the TermsFeed app.
  2. Get access to the Cloudflare Pages project: the Git repository it deploys, or the folder you upload.
  3. Open Copy HTML for your agreement and check that it shows the code. The "Copy HTML is not included" notice in place of the code leaves you the Live Link.

Step 1: Copy the HTML code of your agreement

Copy the code in the language the page shows.

  1. Open your agreement in the TermsFeed app and select Copy HTML in the sidebar.
  2. Select the tab of the language you publish, where the screen shows tabs.
  3. Click Copy under the code.

The code is a fragment for the content area of a page, with no <html>, <head>, or <body> element and no styles. Read what else it holds in Copy Your Agreement as HTML Code.

Step 2: Add a page for the agreement to your project

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 with Direct 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.

Add the link to the footer template your pages share. Point it at your new page, or at the Live Link to keep the text on the TermsFeed app. Copy the Live Link from the Install screen of the agreement, with Copy beside the address under "Your Live Link".

To keep the Live Link behind an address on your own domain, add a line to a _redirects file in the same folder as your pages. Each line holds the path, the destination, and the status code, and 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 4: Deploy the site

Deploy the change to production, the way your project publishes. 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, then 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.

Cloudflare Pages keeps each file in its cache until your next deployment, so a deployment needs no purge. A cache rule you added to a custom domain keeps serving the old page until you purge it. Narrow that rule and purge the page address, as the custom domains documentation of Cloudflare Pages describes.

How to check the policy on your live website

Wait until the deployment shows as complete in the Cloudflare dashboard, then run the check in a private window, which loads the site without the cache of your own browser.

  1. 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.
  2. Load the same address with .html at the end. The browser lands on the address without .html.
  3. Click the footer link to the redirect path, such as /terms. The Live Link opens on the TermsFeed app.
  4. Open the Live Link of the agreement in a second tab and compare the "Last updated" line with your page. The 2 dates match while the pasted copy is current.

Common mistakes on Cloudflare Pages

Open the deployment in the Cloudflare dashboard first, because it lists the files Cloudflare Pages serves.

  • 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 _redirects file 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. The file keeps the code from the day you pasted it. 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 behind the Live Link is switched off or not yet activated. Get it back with Policy Link Opens the TermsFeed Website Instead.

Your site styles, a missing stylesheet, and a static site generator each change how the pasted text looks. Track down the cause with Pasted Agreement Looks Wrong on Your Website.