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