Add support for user-provided comments with Giscus

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.
This commit is contained in:
Hugo Locurcio
2024-01-11 17:51:53 +01:00
parent f6d53d141e
commit 95fb178429
65 changed files with 149 additions and 2 deletions
+29
View File
@@ -66,6 +66,35 @@
{% endif %}
{% block body %}{% endblock %}
{% if (not meta or meta.get('allow_comments') != 'False') and godot_show_article_comments %}
<hr>
<h2>User-contributed notes</h2>
<p>
<em>Please read the <a href="https://github.com/godotengine/godot-docs-user-notes/discussions/1">User-contributed notes policy</a> before submitting a comment.</em>
</p>
{# Use https://giscus.app/ to regenerate the script tag if needed. #}
{# data-term is set to be language-independent and version-independent, so that comments can be centralized for each page. #}
{# This increases the likelihood that users will encounter comments on less frequently visited pages. #}
<script src="https://giscus.app/client.js"
data-repo="godotengine/godot-docs-user-notes"
data-repo-id="R_kgDOKuNx0w"
data-category="User-contributed notes"
data-category-id="DIC_kwDOKuNx084CbANb"
data-mapping="specific"
data-term="{{ pagename }}"
data-strict="1"
data-reactions-enabled="0"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="preferred_color_scheme"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous"
async></script>
<br>
{% endif %}
{%- if self.comments()|trim %}
<div class="articleComments">
{%- block comments %}{% endblock %}
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_complying_with_licenses:
Complying with licenses
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_docs_changelog:
Documentation changelog
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. meta::
:keywords: FAQ
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_about_intro:
Introduction
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_list_of_features:
List of features
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_release_policy:
Godot release policy
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Asset Library
=============
+2
View File
@@ -196,6 +196,8 @@ html_context = {
"godot_version": "4.3",
# Enables a banner that displays the up-to-date status of each article.
"godot_show_article_status": True,
# Display user-contributed notes at the bottom of pages that don't have `:allow_comments: False` at the top.
"godot_show_article_comments": on_rtd and not is_i18n,
}
html_logo = "img/docs_logo.svg"
@@ -1,3 +1,5 @@
:allow_comments: False
Building from source
====================
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_configuring_an_ide:
Configuring an IDE
@@ -1,3 +1,5 @@
:allow_comments: False
Engine core and modules
=======================
@@ -1,3 +1,5 @@
:allow_comments: False
Debugging and profiling
=======================
@@ -1,3 +1,5 @@
:allow_comments: False
Vulkan
======
@@ -1,3 +1,5 @@
:allow_comments: False
Editor development
==================
@@ -1,3 +1,5 @@
:allow_comments: False
Godot file formats
==================
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_contributing_to_the_engine:
Engine development
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_contributing_writing_documentation:
Writing documentation
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_contributing_workflow:
Contribution workflow
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_your_first_2d_game:
Your first 2D game
+1
View File
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True
.. _doc_your_first_3d_game:
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. Intention: provide the necessary information to make the most of the getting
started series, answering questions like "do I want to learn Godot?", "how
does it look and feel?", "how does it work?", and "how do I best learn it?".
+1 -1
View File
@@ -1,4 +1,4 @@
:article_outdated: False
:allow_comments: False
Step by step
============
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Godot Docs *master* branch
============================
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
2D
==
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_global_illumination:
Global illumination
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
3D
==
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_3d_particles:
Particle systems (3D)
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_procedural_geometry:
Procedural geometry
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Animation
=========
@@ -1,3 +1,5 @@
:allow_comments: False
Blender ESCN exporter
=====================
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_importing_3d_scenes:
Importing 3D scenes
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Assets pipeline
===============
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
:article_outdated: True
Audio
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Best practices
==============
+1
View File
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True
Editor introduction
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Export
======
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Internationalization
====================
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Input handling
==============
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
File and data I/O
=================
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Math
====
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Migrating to a new version
==========================
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Navigation
==========
+1
View File
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True
Networking
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_performance:
Performance
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True
Animating thousands of objects
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Physics
=======
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Android
=======
+1
View File
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True
Platform-specific
+1
View File
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True
iOS plugins
+1
View File
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True
.. _doc_platform_html5:
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Editor plugins
==============
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Plugins
=======
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Rendering
=========
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_c_sharp_diagnostics:
C# diagnostics
+2 -1
View File
@@ -1,3 +1,5 @@
:allow_comments: False
C#/.NET
=======
@@ -8,7 +10,6 @@ The standard Godot executable does not contain C# support out of the box. Instea
to enable C# support for your project you need to `download a .NET version <https://godotengine.org/download/>`_
of the editor from the Godot website.
.. toctree::
:maxdepth: 1
:name: toc-learn-scripting-C#
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Debug
=====
@@ -1,3 +1,5 @@
:allow_comments: False
GDExtension
===========
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
GDScript
========
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Scripting
=========
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
Shaders
=======
@@ -1,3 +1,5 @@
:allow_comments: False
Shading reference
=================
@@ -1,3 +1,5 @@
:allow_comments: False
Your first shader
=================
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
.. _doc_user_interface:
User interface (UI)
+2
View File
@@ -1,3 +1,5 @@
:allow_comments: False
XR
==