A Payload site, ready to clone

Placeholder: rounded tiles in soft blue and orange

A link field that follows the page it links to

Why

A url field takes an address typed by hand, so a link to a page breaks when the page’s slug changes. A link field, --field cta:link, stores the page itself instead: on the site it always goes to the page’s current URL, in the language of the page it is shown on.

In the admin

The editor chooses between content of the site and a URL. Content is found with the admin’s search, by title, among the pages, the posts and the documents of every collection with pages of its own. A URL is checked as a url field’s. The link’s text is optional and per language; left empty, the page shows the linked content’s title, or the URL.

On the page

A link to content that isn’t published, or isn’t translated into the page’s language, shows nothing, and neither does an unsafe address. A collection with pages added later becomes linkable after the next migration, with no change to the field. The README’s “Generators” has the details.

A collection of offers with a call to action
pnpm make:collection offers --slug acmeOffers --path /offers \
  --singular en=Offer --plural en=Offers \
  --field cta:link:required --dry-run