What is and where do I set a page id?

I’m using the page helper to link to pages:

<a href="<?= page('example-page')->url() ?>">

I understand the page helper ‘finds’ the page with the id ‘example-page’ and then will make an absolute link from it.

But where or how do I give my ‘example-page’ an id? Are these set automatically? A page id seems to be the same as the page name?

Since upgrading to the latest version of Kirby I can see that my page .txt files have all been given a Uuid. But I can’t see in my page .txt files an id. Yet the above page helper works.

No, not exactly. For a first level page, the id is equal to the slug/folder name, but for pages further down the tree, it’s the path to this page,

content/
  blog/
    article-one/

Get the blog page

page('blog')

Get the article

page('blog/article-one')

So if ‘article-one’ was moved to:

content/
   article-one/
   blog/

Then the ID of the page changes to ‘article-one’?
So the ID is not a unique identifying name for a page - it changes depending on where the page is in the structure?
So for the page helper to work I need to tell it where the page is in the structure (which folder it is in)?

If I use the new Uuid unique identifying code, to link to a page using the page helper, do I need to know where the page is in the structure (what folders it is in), or will Kirby simply find the page and create the link for me?

No, it’s unique.