Set page frontmatter per link

Hi everyone,

I am trying to implement a simple function but am unsure on how to best do it. Basically I want to display a link on certain pages that, when clicked on adds the current user to the page frontmatter.

Is it possible to do this in twig? If not, do I need a custom plugin? I would appreciate if someone could give me some pointers on how to best solve this.

Thanks in advance,
Paul R.

I think you’ll need to create a plugin for that. My route would be to setup a Grav form which submits via Ajax and let the plugin handle the onFormProcessed() event to add the logged in(!) user’s username or full name to that page frontmatter and save that file.

Maybe you can re-use code from the Add Page by Form Plugin.