How to write change date directly to .txt? Best way with hooks?

In a (multilingual) project, I have integrated a tab on site.yml that lists the most recently changed pages. This works well on the live server.

When I make a backup of the content-folder via FTP tool and use it locally (with MAMP), the date of the backup is displayed as the modification date. This is not desirable, as it is no longer possible to see which page was last changed on the server.

Now my idea is to save a timestamp in the .txt after each save and display this value as the modification date. Is this possible with the hook page.update:after? Or for a multilingual website with language.update:after?

If only one of the additional languages is changed, this page should also be displayed as “last changed”.

I haven’t actively worked with hooks before, unfortunately I don’t have the necessary knowledge of how to use hooks sensibly.

I was using the “Recently Modified” plugin from @bnomei. However, this only shows the modified pages per user. This does not correspond to my solution.

This is my Blueprint tab for displaying the currently changed pages:

label: Changelog
icon: history-line
sections:
  changedpages:
    label: "Kürzlich geänderte Seiten"
    type: pages
    query: site.index(true).sortBy('modified', 'desc')
    create: false
    layout: table
    columns:
      parentpage:
        label: "Ăśbergeordnete Seite"
        value: "{{ page.parent ? page.parent.title : 'keine' }}"
        width: 1/6
      day:
        label: Datum
        value: "{{ page.modified('Y-m-d') }}"
        width: 1/6
      time:
        label: Uhrzeit
        value: "{{ page.modified('H:i:s') }}"
        width: 1/6
    image:
      back: "#000000"
      color: "#ffffff"
      query: false
    limit: 15
    search: true

Depending how you download from the server, you should be able to preserve the file modification dates.

Other than that, I’d probably not use a hook, but a base page model.

This valuable tip is the solution! Thank you! :ok_hand:
I use Transmit for FTP transfers as I really appreciate the powerful filter rules. And in the depths of the preferences, I also found the checkbox to keep the modification date.