Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Set page frontmatter per link

Started by Paul Richter 7 years ago · 1 replies · 431 views
7 years ago

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.

7 years ago

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.

Suggested topics

Topic Participants Replies Views Activity
Support · by David Meissner, 5 days ago
5 152 10 hours ago
Support · by kskt, 4 days ago
2 102 18 hours ago
Support · by BenLaKnet, 7 days ago
1 144 4 days ago
Support · by BenLaKnet, 1 week ago
5 211 4 days ago
Support · by David Meissner, 4 days ago
0 70 4 days ago