Skip to content

Allow the site to load even if the external CSS does not #980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,32 @@
<meta name="generator" content="docs.rs {{ docsrs_version() }}">
{%- block meta -%}{%- endblock meta -%}

{# External styles #}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css" type="text/css"
media="all" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-responsive-min.css"
type="text/css" media="all" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css" />

{# Docs.rs styles #}
<link rel="stylesheet" href="/normalize-{{ rustc_resource_suffix() }}.css" type="text/css" media="all" />
<link rel="stylesheet" href="/rustdoc-{{ rustc_resource_suffix() }}.css" type="text/css" media="all" />
<link rel="stylesheet" href="/light-{{ rustc_resource_suffix() }}.css" type="text/css" media="all" />
<link rel="stylesheet" href="/style.css?{{ docsrs_version() | slugify }}" type="text/css" media="all" />

{%- block css -%}{%- endblock css -%}

<link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Docs.rs">

<title>{%- block title -%} Docs.rs {%- endblock title -%}</title>
</head>

<body>
{%- include "header/topbar.html" -%}
{# External styles, loaded in the body so the site will be available even if these don't load #}
{%- block css -%}{%- endblock css -%}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css" type="text/css"
media="all" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-responsive-min.css"
type="text/css" media="all" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css" />

{%- include "header/topbar.html" -%}
{%- block header %}{% endblock header -%}

{%- block body -%}{%- endblock body -%}
</body>

<script type="text/javascript" src="/menu.js?{{ docsrs_version() | slugify }}"></script>
<script type="text/javascript" src="/index.js?{{ docsrs_version() | slugify }}"></script>

{%- block javascript -%}{%- endblock javascript -%}

<script type="text/javascript" src="/menu.js?{{ docsrs_version() | slugify }}"></script>
<script type="text/javascript" src="/index.js?{{ docsrs_version() | slugify }}"></script>
{%- block javascript -%}{%- endblock javascript -%}
</body>
</html>
7 changes: 7 additions & 0 deletions templates/rustdoc/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
{# The url of the current release, `/crate/:name/:version` #}
{%- set crate_url = "/crate/" ~ krate.name ~ "/" ~ krate.version -%}

{# Load CSS in the body, not the head, so that pages will still be visible even if the external provider goes down #}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/menus-min.css" type="text/css"
media="all" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-min.css" type="text/css"
media="all" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css" />

<div class="nav-container nav-container-rustdoc">
<div class="container-rustdoc rustdoc-navigation">
<div class="pure-menu pure-menu-horizontal">
Expand Down
6 changes: 0 additions & 6 deletions templates/rustdoc/head.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{%- import "macros.html" as macros -%}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/menus-min.css" type="text/css"
media="all" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-min.css" type="text/css"
media="all" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css" />
<link rel="stylesheet" href="/style.css?{{ docsrs_version() | slugify }}" type="text/css" media="all" />

<link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Docs.rs">