diff options
Diffstat (limited to 'nikola/data/themes/base-jinja/templates/post_helper.tmpl')
| -rw-r--r-- | nikola/data/themes/base-jinja/templates/post_helper.tmpl | 63 |
1 files changed, 18 insertions, 45 deletions
diff --git a/nikola/data/themes/base-jinja/templates/post_helper.tmpl b/nikola/data/themes/base-jinja/templates/post_helper.tmpl index e2dcf59..94b3c05 100644 --- a/nikola/data/themes/base-jinja/templates/post_helper.tmpl +++ b/nikola/data/themes/base-jinja/templates/post_helper.tmpl @@ -1,4 +1,5 @@ {# -*- coding: utf-8 -*- #} +{% import 'math_helper.tmpl' as math with context %} {% macro meta_translations(post) %} {% if translations|length > 1 %} @@ -40,31 +41,29 @@ {% endmacro %} {% macro open_graph_metadata(post) %} -{% if use_open_graph %} - <meta property="og:site_name" content="{{ blog_title|e }}"> - <meta property="og:title" content="{{ post.title()[:70]|e }}"> - <meta property="og:url" content="{{ abs_link(permalink) }}"> - {% if post.description() %} +<meta property="og:site_name" content="{{ blog_title|e }}"> +<meta property="og:title" content="{{ post.title()[:70]|e }}"> +<meta property="og:url" content="{{ abs_link(permalink) }}"> +{% if post.description() %} <meta property="og:description" content="{{ post.description()[:200]|e }}"> - {% else %} +{% else %} <meta property="og:description" content="{{ post.text(strip_html=True)[:200]|e }}"> - {% endif %} - {% if post.previewimage %} +{% endif %} +{% if post.previewimage %} <meta property="og:image" content="{{ url_replacer(permalink, post.previewimage, lang, 'absolute') }}"> - {% endif %} - <meta property="og:type" content="article"> +{% endif %} +<meta property="og:type" content="article"> {# Will only work with Pintrest and breaks everywhere else who expect a [Facebook] URI. #} {# %if post.author(): #} {# <meta property="article:author" content="{{ post.author()|e }}"> #} {# %endif #} - {% if post.date.isoformat() %} +{% if post.date.isoformat() %} <meta property="article:published_time" content="{{ post.formatted_date('webiso') }}"> - {% endif %} - {% if post.tags %} - {% for tag in post.tags %} - <meta property="article:tag" content="{{ tag|e }}"> - {% endfor %} - {% endif %} +{% endif %} +{% if post.tags %} + {% for tag in post.tags %} + <meta property="article:tag" content="{{ tag|e }}"> + {% endfor %} {% endif %} {% endmacro %} @@ -84,33 +83,7 @@ {% endif %} {% endmacro %} +{# This function is deprecated; use math_helper directly. #} {% macro mathjax_script(post) %} - {% if post.is_mathjax %} - {% if use_katex %} - <script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js"></script> - <script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/contrib/auto-render.min.js"></script> - {% if katex_auto_render %} - <script> - renderMathInElement(document.body, - { - {{ katex_auto_render }} - } - ); - </script> - {% else %} - <script> - renderMathInElement(document.body); - </script> - {% endif %} - {% else %} - <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script> - {% if mathjax_config %} - {{ mathjax_config }} - {% else %} - <script type="text/x-mathjax-config"> - MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}}); - </script> - {% endif %} - {% endif %} - {% endif %} + {{ math.math_scripts_ifpost(post) }} {% endmacro %} |
