mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-18 00:52:24 -06:00
91 lines
3.2 KiB
HTML
91 lines
3.2 KiB
HTML
{%- comment -%}
|
|
Include as: {%- include head.html -%}
|
|
Depends on: site.ga_tracking, site.ga_tracking_anonymize_ip,
|
|
site.search_enabled, site.static_files, site.favicon_ico.
|
|
Results in: HTML for the head element.
|
|
Includes:
|
|
head_nav.html, head_custom.html.
|
|
Overwrites:
|
|
ga_tracking_ids, ga_property, file, favicon.
|
|
Should not be cached, because included files depend on page.
|
|
{%- endcomment -%}
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
|
|
|
{% if site.color_scheme_options and site.color_scheme_options.enable_localstorage %}
|
|
<script>
|
|
(function(){
|
|
function createThemeStylesheet(theme, media) {
|
|
var link = document.createElement('link');
|
|
link.rel = 'stylesheet';
|
|
link.type = 'text/css';
|
|
link.href = "{{ '/assets/css/just-the-docs-*.css' | relative_url }}".replace("*",theme);
|
|
if(media) link.media = media;
|
|
return link;
|
|
}
|
|
|
|
var theme = window.localStorage.getItem('theme');
|
|
var head = document.getElementsByTagName('head')[0];
|
|
|
|
if (theme === null) {
|
|
theme = "{{ site.color_scheme }}";
|
|
}
|
|
|
|
if (theme === "nil") {
|
|
theme = "default";
|
|
}
|
|
|
|
if (theme === "auto") {
|
|
head.appendChild(createThemeStylesheet('light', '(prefers-color-scheme: light)'));
|
|
head.appendChild(createThemeStylesheet('dark', '(prefers-color-scheme: dark)'));
|
|
} else {
|
|
head.appendChild(createThemeStylesheet(theme || "default"));
|
|
}
|
|
})();
|
|
</script>
|
|
{% else %}
|
|
{% case site.color_scheme %}
|
|
{% when "auto" %}
|
|
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-light.css' | relative_url }}" type="text/css" media="(prefers-color-scheme: light)">
|
|
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-dark.css' | relative_url }}" type="text/css" media="(prefers-color-scheme: dark)">
|
|
{% when nil %}
|
|
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | relative_url }}" type="text/css">
|
|
{% else %}
|
|
<link rel="stylesheet" href="{{ site.color_scheme | prepend: '/assets/css/just-the-docs-' | append: '.css' | relative_url }}" type="text/css">
|
|
{% endcase %}
|
|
{% endif %}
|
|
|
|
{% include head_nav.html %}
|
|
|
|
{% if site.ga_tracking != nil %}
|
|
{% assign ga_tracking_ids = site.ga_tracking | split: "," %}
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id={{ ga_tracking_ids.first }}"></script>
|
|
<script>
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
|
|
{% for ga_property in ga_tracking_ids %}
|
|
gtag('config', '{{ ga_property }}'{% unless site.ga_tracking_anonymize_ip == nil %}, { 'anonymize_ip': true }{% endunless %});
|
|
{% endfor %}
|
|
</script>
|
|
{% endif %}
|
|
|
|
{% if site.search_enabled != false %}
|
|
<script src="{{ '/assets/js/vendor/lunr.min.js' | relative_url }}"></script>
|
|
{% endif %}
|
|
|
|
<script src="{{ '/assets/js/just-the-docs.js' | relative_url }}"></script>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
{% include_cached favicon.html %}
|
|
|
|
{% seo %}
|
|
|
|
{% include head_custom.html %}
|
|
|
|
</head>
|