Skip to content

Commit

Permalink
Add support for user-provided comments with Giscus
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Calinou committed Jan 11, 2024
1 parent f6d53d1 commit e7b4dda
Show file tree
Hide file tree
Showing 64 changed files with 147 additions and 2 deletions.
29 changes: 29 additions & 0 deletions _templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
2 changes: 2 additions & 0 deletions about/complying_with_licenses.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_complying_with_licenses:

Complying with licenses
Expand Down
2 changes: 2 additions & 0 deletions about/docs_changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_docs_changelog:

Documentation changelog
Expand Down
2 changes: 2 additions & 0 deletions about/faq.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. meta::
:keywords: FAQ

Expand Down
2 changes: 2 additions & 0 deletions about/introduction.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_about_intro:

Introduction
Expand Down
2 changes: 2 additions & 0 deletions about/list_of_features.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_list_of_features:

List of features
Expand Down
2 changes: 2 additions & 0 deletions about/release_policy.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_release_policy:

Godot release policy
Expand Down
2 changes: 2 additions & 0 deletions community/asset_library/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Asset Library
=============

Expand Down
2 changes: 2 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
"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"
Expand Down
2 changes: 2 additions & 0 deletions contributing/development/compiling/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Building from source
====================

Expand Down
2 changes: 2 additions & 0 deletions contributing/development/configuring_an_ide/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_configuring_an_ide:

Configuring an IDE
Expand Down
2 changes: 2 additions & 0 deletions contributing/development/core_and_modules/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Engine core and modules
=======================

Expand Down
2 changes: 2 additions & 0 deletions contributing/development/debugging/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Debugging and profiling
=======================

Expand Down
2 changes: 2 additions & 0 deletions contributing/development/debugging/vulkan/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Vulkan
======

Expand Down
2 changes: 2 additions & 0 deletions contributing/development/editor/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Editor development
==================

Expand Down
2 changes: 2 additions & 0 deletions contributing/development/file_formats/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Godot file formats
==================

Expand Down
2 changes: 2 additions & 0 deletions contributing/development/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_contributing_to_the_engine:

Engine development
Expand Down
2 changes: 2 additions & 0 deletions contributing/documentation/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_contributing_writing_documentation:

Writing documentation
Expand Down
2 changes: 2 additions & 0 deletions contributing/workflow/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_contributing_workflow:

Contribution workflow
Expand Down
2 changes: 2 additions & 0 deletions getting_started/first_2d_game/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_your_first_2d_game:

Your first 2D game
Expand Down
1 change: 1 addition & 0 deletions getting_started/first_3d_game/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True

.. _doc_your_first_3d_game:
Expand Down
2 changes: 2 additions & 0 deletions getting_started/introduction/index.rst
Original file line number Diff line number Diff line change
@@ -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?".
Expand Down
2 changes: 1 addition & 1 deletion getting_started/step_by_step/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:article_outdated: False
:allow_comments: False

Step by step
============
Expand Down
2 changes: 2 additions & 0 deletions index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Godot Docs – *master* branch
============================

Expand Down
2 changes: 2 additions & 0 deletions tutorials/2d/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

2D
==

Expand Down
2 changes: 2 additions & 0 deletions tutorials/3d/global_illumination/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_global_illumination:

Global illumination
Expand Down
2 changes: 2 additions & 0 deletions tutorials/3d/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

3D
==

Expand Down
2 changes: 2 additions & 0 deletions tutorials/3d/particles/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_3d_particles:

Particle systems (3D)
Expand Down
2 changes: 2 additions & 0 deletions tutorials/3d/procedural_geometry/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_procedural_geometry:

Procedural geometry
Expand Down
2 changes: 2 additions & 0 deletions tutorials/animation/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Animation
=========

Expand Down
2 changes: 2 additions & 0 deletions tutorials/assets_pipeline/escn_exporter/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Blender ESCN exporter
=====================

Expand Down
2 changes: 2 additions & 0 deletions tutorials/assets_pipeline/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Assets pipeline
===============

Expand Down
2 changes: 2 additions & 0 deletions tutorials/audio/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

:article_outdated: True

Audio
Expand Down
2 changes: 2 additions & 0 deletions tutorials/best_practices/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Best practices
==============

Expand Down
1 change: 1 addition & 0 deletions tutorials/editor/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True

Editor introduction
Expand Down
2 changes: 2 additions & 0 deletions tutorials/export/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Export
======

Expand Down
2 changes: 2 additions & 0 deletions tutorials/i18n/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Internationalization
====================

Expand Down
2 changes: 2 additions & 0 deletions tutorials/inputs/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Input handling
==============

Expand Down
2 changes: 2 additions & 0 deletions tutorials/io/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

File and data I/O
=================

Expand Down
2 changes: 2 additions & 0 deletions tutorials/math/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Math
====

Expand Down
2 changes: 2 additions & 0 deletions tutorials/migrating/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Migrating to a new version
==========================

Expand Down
2 changes: 2 additions & 0 deletions tutorials/navigation/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Navigation
==========

Expand Down
1 change: 1 addition & 0 deletions tutorials/networking/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True

Networking
Expand Down
2 changes: 2 additions & 0 deletions tutorials/performance/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_performance:

Performance
Expand Down
1 change: 1 addition & 0 deletions tutorials/performance/vertex_animation/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True

Animating thousands of objects
Expand Down
2 changes: 2 additions & 0 deletions tutorials/physics/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Physics
=======

Expand Down
2 changes: 2 additions & 0 deletions tutorials/platform/android/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Android
=======

Expand Down
1 change: 1 addition & 0 deletions tutorials/platform/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True

Platform-specific
Expand Down
1 change: 1 addition & 0 deletions tutorials/platform/ios/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True

iOS plugins
Expand Down
1 change: 1 addition & 0 deletions tutorials/platform/web/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:allow_comments: False
:article_outdated: True

.. _doc_platform_html5:
Expand Down
2 changes: 2 additions & 0 deletions tutorials/plugins/editor/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Editor plugins
==============

Expand Down
2 changes: 2 additions & 0 deletions tutorials/plugins/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Plugins
=======

Expand Down
2 changes: 2 additions & 0 deletions tutorials/rendering/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Rendering
=========

Expand Down
2 changes: 2 additions & 0 deletions tutorials/scripting/c_sharp/diagnostics/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

.. _doc_c_sharp_diagnostics:

C# diagnostics
Expand Down
3 changes: 2 additions & 1 deletion tutorials/scripting/c_sharp/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

C#/.NET
=======

Expand All @@ -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#
Expand Down
2 changes: 2 additions & 0 deletions tutorials/scripting/debug/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Debug
=====

Expand Down
2 changes: 2 additions & 0 deletions tutorials/scripting/gdextension/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

GDExtension
===========

Expand Down
2 changes: 2 additions & 0 deletions tutorials/scripting/gdscript/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

GDScript
========

Expand Down
2 changes: 2 additions & 0 deletions tutorials/scripting/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Scripting
=========

Expand Down
2 changes: 2 additions & 0 deletions tutorials/shaders/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Shaders
=======

Expand Down
2 changes: 2 additions & 0 deletions tutorials/shaders/shader_reference/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:allow_comments: False

Shading reference
=================

Expand Down
Loading

0 comments on commit e7b4dda

Please sign in to comment.