Use environment variable to control indexing of rendered docs #15664
Labels
status: accepted
This issue has been accepted for implementation
type: housekeeping
Changes to the application which do not directly impact the end user
Proposed Changes
When the NetBox documentation is rendered using
mkdocs
, we ensure that indexing by search engines is disabled unless it has been built for ReadTheDocs. This is done to avoid search engines accidentally caching the local documentation served by publicly-exposed NetBox deployments in the wild, which taints search results.This is currently accomplished by checking that the
page.canonical_url
context variable is set todocs.netbox.dev
:netbox/docs/_theme/main.html
Lines 6 to 8 in b7668fb
This approach is taken because ReadTheDocs currently does not support the use of environment variables within
mkdocs
configuration files. However, per this recent blog post, support for referencing environment variables will be introduced on April 15. (See also this comment.)I've opened this issue to track the switch to using an environment variable instead of the context variable (essentially reverting efd8652).
Justification
The environment approach is more flexible as it more customizable and does not rely on an exact string match.
The text was updated successfully, but these errors were encountered: