Skip to content

Commit

Permalink
theme: add blocks site_meta, htmltitle, analytics
Browse files Browse the repository at this point in the history
Recover these blocks from the original mkdocs theme:
https://github.com/mkdocs/mkdocs/blob/master/mkdocs/themes/mkdocs/base.html
  • Loading branch information
j1elo committed Sep 29, 2021
1 parent 0660567 commit ce8a5c3
Showing 1 changed file with 54 additions and 14 deletions.
68 changes: 54 additions & 14 deletions custom_theme/base.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
<!-- Exclude all templates under ./common folder -->
{# Exclude all templates under ./common folder #}
{% if page.title != 'Releases content' %}



<!DOCTYPE html>
<html lang="{{ config.theme.locale|default('en') }}">
<head>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="keywords" content="OpenVidu, openvidu, WebRTC, Video, mobile" />
{%- block site_meta %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="OpenVidu, openvidu, WebRTC, Video, mobile" />
{% if page and page.is_homepage %}<meta name="description" content="{{ config['site_description'] }}">{% endif %}
{% if config.site_author %}<meta name="author" content="{{ config.site_author }}">{% endif %}
{% if page and page.canonical_url %}<link rel="canonical" href="{{ page.canonical_url }}">{% endif %}
{% if config.site_favicon %}<link rel="shortcut icon" href="{{ config.site_favicon|url }}">
{% else %}<link rel="shortcut icon" href="{{ 'img/favicon.ico'|url }}">{% endif %}
{%- endblock %}

{%- block htmltitle %}
<title>{% if page and page.title and not page.is_homepage %}{{ page.title }} - {% endif %}{{ config.site_name }}</title>
{%- endblock %}

<!--
Create a `<base>` element that matches the current RTD version.
Expand Down Expand Up @@ -46,8 +57,6 @@
<base href="/" />
{%- endif %}

<title>OpenVidu Docs</title>
<link rel="icon" href="img/favicon.ico" type="image/x-icon">
<!-- Stlylesheet -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/style-custom.css" rel="stylesheet" type="text/css" />
Expand All @@ -58,6 +67,31 @@
<link rel="stylesheet" type="text/css" href="css/downloads/cookieconsent-3.0.3.css" />
<script src="js/plugins/jquery.min.js"></script>
<script src="js/anchor-links.js"></script>

{%- block analytics %}
{%- if config.theme.analytics.gtag %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ config.theme.analytics.gtag }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ config.theme.analytics.gtag }}');
</script>
{%- elif config.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', '{{ config.google_analytics[0] }}', '{{ config.google_analytics[1] }}');
ga('send', 'pageview');
</script>
{%- endif %}
{%- endblock %}

{%- block extrahead %} {% endblock %}
</head>

<body{% if page and page.is_homepage %} class="homepage"{% endif %}>
Expand Down Expand Up @@ -140,7 +174,7 @@ <h4>
<ul id="menu-list">
{% for nav_item in nav %}
<li>
<ul class="top-ul {% if nav_item.active%}current{%endif%}">{% include "toc.html" %}</ul>
<ul class="top-ul {% if nav_item.active %}current{% endif %}">{% include "toc.html" %}</ul>
</li>
{% endfor %}
</ul>
Expand Down Expand Up @@ -298,12 +332,18 @@ <h4>
</body>
</html>

{% if page and page.is_homepage %}
<!--
MkDocs version : {{ mkdocs_version }}
Build Date UTC : {{ build_date_utc }}
-->
{% endif %}



{%else%}
<!-- if page.title == 'Releases content' -->
{% else %} {# if page.title == 'Releases content' #}

<script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
{{ page.content }}

{%endif%}
{% endif %} {# if page.title == 'Releases content' #}

0 comments on commit ce8a5c3

Please sign in to comment.