Adapted from changes to sphinx_rtd_theme (which is vendored in ghc):
commit d34b71bb0977b4265ceff07955e974cfa73a2405
From: Manuel Kaufmann <humitos@gmail.com>
Date: Tue, 29 Aug 2023 11:43:41 +0200
Subject: [PATCH] Use `css_tag` helper to inject CSS files (#1519)

* Use `css_tag` helper to inject CSS files

* Typo
---
 sphinx_rtd_theme/layout.html | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/docs/users_guide/rtd-theme/layout.html b/docs/users_guide/rtd-theme/layout.html
index a83bdd29e..f3de11ad0 100644
--- a/docs/users_guide/rtd-theme/layout.html
+++ b/docs/users_guide/rtd-theme/layout.html
@@ -29,11 +29,7 @@
     <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
   {%- endif %}
-  {%- for css in css_files %}
+  {%- for css_file in css_files %}
-    {%- if css|attr("rel") %}
-      <link rel="{{ css.rel }}" href="{{ pathto(css.filename, 1) }}" type="text/css"{% if css.title is not none %} title="{{ css.title }}"{% endif %} />
-    {%- else %}
-      <link rel="stylesheet" href="{{ pathto(css, 1) }}" type="text/css" />
-    {%- endif %}
+    {{ css_tag(css_file) }}
   {%- endfor %}
 
   {%- for cssfile in extra_css_files %}
