First you have to know the sense of a canonical link (see WIKI-Link of Luisehahne). It is not recommended to have your own canonical on every single page if you have structured contents.
The page with the canonical-link is practically the main page of the respective topic. The best example is the start page of a picture gallery, if it has several pages and a lot of pictures.
Here each gallery page would get the canonical link to the gallery homepage, but not one of its own.
In the index. php of the DefaultTemplate above is a quite simple example that can work if the contents of your website match.
If no such general solution is needed, it may be possible to use a droplet. However, this droplet has to be integrated manually on each subpage, e. g. in a Wysiwyg or Code²
section and can, as for example in the case of the picture gallery, link to the same main page on each of these subpages.
As an example
I have a gallery with 5 subpages about holidays from 5 different years and an introduction. Here I add a Canonical to the introductory page of each gallery and the introductory page itself also has the same Canonical.
You can find this droplet in the attachement. Use the Import-Function from the Droplet to add this droplet and dont forget to set it to "active"Translated with www.DeepL.com/Translator