eduardoboucas / staticman

💪 User-generated content for Git-powered websites
https://staticman.net
MIT License
2.42k stars 541 forks source link

Ability to add Blog Title or the Slug as PR Title and Full Comment in PR Body #362

Open sirinath opened 4 years ago

sirinath commented 4 years ago

Is it possible to add the ability to configure so that

This will make it easy to sort and review comments.

VincentTam commented 3 years ago

The PR message body can be customized through fields. In Hugo, you can customize the PR title through the options parameter.

<input type="hidden" name="options[slug]" value="{{ replace .RelPermalink "/" "" }}">

source: https://github.com/halogenica/beautifulhugo/blob/1ff3894b84b1802433b58e22dd22f4eb46a49fa9/layouts/partials/staticman-comments.html#L39

To address your problem, it suffices to

  1. replace options with fields.
  2. customize the index inside [].
  3. adapt {{ replace .RelPermalink "/" "" }} to the syntax of your static site generator.

The screenshot below shows that all fields named fields[*] are shown in the PR body.

image

@alexwaibel Implementing the suggested feature would complicate the current code. I suggest closing this.

sirinath commented 3 years ago

Can I make the PR title reflect the blog title instead of "Add Staticman Data"?

VincentTam commented 3 years ago

Can I make the PR title reflect the blog title instead of "Add Staticman Data"?

@SilentComics You may use the site config param commitMessage.