Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for user-provided comments with Giscus #7520

Merged
merged 1 commit into from
Jan 13, 2024

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jun 15, 2023

In a fashion similar to https://php.net's comments, this allows users to leave comments on pages that don't have :allow_comments: False somewhere in the page's source. Both manual and class reference pages can receive comments. Index pages cannot have comments, as discussion should occur on "leaf" pages.

GitHub Discussions is used as a backend on the same repository.1 This means that Discussions must be enabled on godotengine/godot-docs before this commit is merged to master. Users can choose to use the "Custom" watch mode if they don't want to get notifications for discussion updates, but still get notifications for issue and pull request updates.

User comments are intended to be used for the following purposes:

  • Add a clarification or correct something in the documentation, without having to open a pull request. Contributors are encouraged to take a look at discussions from time to time, and see if there's information worth incorporating in the pages themselves. Don't forget to reply to the comment when doing so 🙂
  • Mention a workaround for a common issue.
  • Link to useful third-party resources that are relevant to the current page, such as tutorials or add-ons.

User comments should not be used for technical support. Other community platforms should be used for that.

More details can be found in the User-contributed notes policy I've written.

Page-to-discussion matching is done using the pagename Sphinx variable, which is independent of the Godot version and documentation language. Being independent of the Godot version allows keeping old comments when the Godot version changes, while also allowing users from /stable and /4.0 to "see" each other in discussions.

See https://giscus.app for more information.

TODO

  • Add :allow_comments: False on all index/listing pages.
  • Modify makerst.py in the main Godot repository to write :allow_comments: False at the top of classes/index.rst, as was done manually here. makerst: Disallow user-contributed notes on the class index page godot#85006
  • Set up Discussions on godotengine/godot-docs godotengine/godot-docs-user-notes and use the Giscus setup form again, so that the discussion category unique ID is updated. Use the following options, with "Calinou/godot-docs" replaced by "godotengine/godot-docs".
    • Rename the default Announcements category to Page comments while keeping its type on Announcements. Change its emoji to 🗨️. Remove all other categories, so that users cannot create discussions manually (the Giscus app will do it for them).
    • Create a second category called Rules with the Announcements type and 📏 emoji.
    • Create a post called "User-contributed notes policy" in the Rules category with the contents from https://github.com/Calinou/godot-docs/discussions/46, then pin the post globally (not in a single category) and lock it. Make sure reactions are not allowed when locking the post. Use the Markdown code below.
  • Replace URL to the User-contributed notes policy in layout.html to point to godot-docs' version, rather than the Calinou fork.

Preview

https://github.com/godotengine/godot-docs-user-notes/discussions

Example at the bottom of the 3D text page

The theme follows the system theme, which means it'll adapt to the documentation's theme automatically.

image

Footnotes

  1. We can choose to use a dedicated repository containing just discussions if we wish to do so.

@Calinou Calinou marked this pull request as draft June 15, 2023 02:34
@Calinou Calinou added enhancement content:website Issues related to adding website features and fixing bugs, whether on the front or back-end cherrypick:4.0 cherrypick:3.5 cherrypick:3.6 labels Jun 15, 2023
@Calinou Calinou force-pushed the add-page-comments branch 3 times, most recently from c82273b to df8acb4 Compare June 19, 2023 22:38
@mhilbrunner
Copy link
Member

mhilbrunner commented Sep 6, 2023

The User-contributed notes policy seems good. I'd maybe change the bit about licensing to maybe say in the docs and the Godot project/engine, and try to link to existing license pages for both instead of mentioning any specific license, but not sure.

We should also consider making sure this does not work in local dev builds and in forks by default unless you toggle something, otherwise if another random docs website mirror appears, I could see that lead to confusion. Same for translations - if a page in a non-english translation has no comments yet, it may be too easy to just leave a comment in whatever native language, becoming confusing for other users.

Also need to check how reporting/moderation would work.

I'm also less sure whether we should bother adding this to 3.x docs at all. Everything worth discussing in 3.x has probably already been discussed ad nauseam elsewhere, and we don't get many 3.x docs PRs these days, so I assume most things at this point in time are mostly complete and in a good shape, mature as 3.x is. So I could see the confusion between comments between 2 major versions outweigh the benefit.

Besides those small need-to-check TODOs, this looks good to me and it has my stamp of approval.

@Calinou
Copy link
Member Author

Calinou commented Oct 31, 2023

I'd maybe change the bit about licensing to maybe say in the docs and the Godot project/engine, and try to link to existing license pages for both instead of mentioning any specific license, but not sure.

We don't have the documentation license listed on godotengine.org/license, but I've changed the wording to also mention the engine itself and its license.

We should also consider making sure this does not work in local dev builds and in forks by default unless you toggle something, otherwise if another random docs website mirror appears, I could see that lead to confusion. Same for translations - if a page in a non-english translation has no comments yet, it may be too easy to just leave a comment in whatever native language, becoming confusing for other users.

I've changed it to disable comments integration if not building on Read the Docs, and if the language isn't English. I'm not sure what would be the best way to disable it in forks automatically, preferably at build-time in conf.py.

I'm also less sure whether we should bother adding this to 3.x docs at all. Everything worth discussing in 3.x has probably already been discussed ad nauseam elsewhere, and we don't get many 3.x docs PRs these days, so I assume most things at this point in time are mostly complete and in a good shape, mature as 3.x is. So I could see the confusion between comments between 2 major versions outweigh the benefit.

I agree with making it 4.x-only.

_templates/layout.html Outdated Show resolved Hide resolved
@mhilbrunner
Copy link
Member

mhilbrunner commented Nov 10, 2023

I'm not sure what would be the best way to disable it in forks automatically, preferably at build-time in conf.py.

Yeah, a build var similar to godot_show_article_status in conf.py, but default to false and overridable via an environment var would be easiest (we can set custom env vars in the RTD dashboard).

@Calinou
Copy link
Member Author

Calinou commented Nov 10, 2023

Yeah, a build var similar to godot_show_article_status in conf.py, but default to false and overridable via an environment var would be easiest (we can set custom env vars in the RTD dashboard).

I've added show_article_comments which defaults to on_rtd and not is_i18n in conf.py. This means it's enabled automatically when building on RTD, and only for English.

@Calinou Calinou force-pushed the add-page-comments branch 2 times, most recently from 6b4d807 to 7510e88 Compare November 16, 2023 12:24
@Calinou
Copy link
Member Author

Calinou commented Nov 16, 2023

I've performed repository setup on https://github.com/godotengine/godot-docs-user-notes.

I'll look into updating makerst.py, then we can sync the class reference (just to make sure it works) and merge this PR.

Edit: Done 🙂

_templates/layout.html Outdated Show resolved Hide resolved
classes/index.rst Outdated Show resolved Hide resolved
@Calinou
Copy link
Member Author

Calinou commented Jan 11, 2024

Rebased and tested again, it works as expected. Pages in the About section no longer allow comments too.

This allows users to leave comments on pages that don't have
`:allow_comments: False` somewhere in the page's source.
Both manual and class reference pages can receive comments.
Index pages cannot have comments, as discussion should occur on "leaf" pages.

GitHub Discussions is used as a backend on the same repository. This means
that Discussions *must* be enabled on godotengine/godot-docs before this
commit is merged to `master`. Users can choose to use the "Custom" watch
mode if they don't want to get notifications for discussion updates,
but still get notifications for issue and pull request updates.

User comments are intended to be used for the following purposes:

- Add a clarification or correct something in the documentation,
  without having to open a pull request. Contributors are encouraged to
  take a look at discussions from time to time, and see if there's information
  worth incorporating in the pages themselves. Don't forget to reply to
  the comment when doing so :)
- Mention a workaround for a common issue.
- Link to useful third-party resources that are relevant to the current page,
  such as tutorials or add-ons.

User comments should *not* be used for technical support. Other community
platforms should be used for that.

Page-to-discussion matching is done using the `pagename` Sphinx variable,
which is independent of the Godot version and documentation language.
Being independent of the Godot version allows keeping old comments
when the Godot version changes, while also allowing users from `/stable`
and `/4.1` to "see" each other in discussions.

See https://giscus.app for more information.
@mhilbrunner mhilbrunner merged commit 01a7b2f into godotengine:master Jan 13, 2024
1 check passed
@mhilbrunner
Copy link
Member

Thanks for working on this! Let's see how this works out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick:4.0 cherrypick:4.1 cherrypick:4.2 content:website Issues related to adding website features and fixing bugs, whether on the front or back-end enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants