Skip to content

Link to static asset is broken for code blocks in the root_doc #121

Description

@pradyunsg

Describe the bug

<img src="${DOCUMENTATION_OPTIONS.URL_ROOT}_static/{{ copybutton_image_path }}" alt="${messages[locale]['copy_to_clipboard']}">

The code uses ${DOCUMENTATION_OPTIONS.URL_ROOT} to locate the static file. However, that is # for the root_doc when building on RTD (likely with dirhtml). This means that the link for the static asset is changed to #_static/copy-button.svg, which doesn't work.

To Reproduce

Steps to reproduce the behavior:

  1. Build any Sphinx documentation with a code block in root_doc, and host it on RTD.
  2. See missing image.

See https://cpython-devguide--679.org.readthedocs.build/ for example.

Expected behavior

The link to the image should be _static/copy-button.svg.

Environment

See https://readthedocs.org/projects/cpython-devguide/builds/13630239/, which is about as much as I know. :)

Additional context

Cross-referencing with python/devguide#679, because... why not. :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions