now only import libraries to highlight code when code exists in post

pull/1/head
kirbylife 2019-11-21 14:27:03 -06:00
parent a2adab7c7d
commit d1558df51a
1 changed files with 8 additions and 4 deletions

View File

@ -3,7 +3,9 @@
{% block extracss %} {% block extracss %}
<link href="/static/css/post.css" rel="stylesheet"/> <link href="/static/css/post.css" rel="stylesheet"/>
{% if post.content is containing("<code>") %}
<link href="/static/css/highlightjs/agate.css" rel="stylesheet"/> <link href="/static/css/highlightjs/agate.css" rel="stylesheet"/>
{% endif %}
{% endblock extracss %} {% endblock extracss %}
{% block content %} {% block content %}
@ -20,8 +22,10 @@
{% endblock content %} {% endblock content %}
{% block extrajs %} {% block extrajs %}
<script src="/static/js/highlight.pack.js"></script> {% if post.content is containing("<code>") %}
<script> <script src="/static/js/highlight.pack.js"></script>
<script>
hljs.initHighlightingOnLoad(); hljs.initHighlightingOnLoad();
</script> </script>
{% endif %}
{% endblock extrajs %} {% endblock extrajs %}