diff options
Diffstat (limited to 'nikola/data/themes/base/templates/post_helper.tmpl')
| -rw-r--r-- | nikola/data/themes/base/templates/post_helper.tmpl | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/nikola/data/themes/base/templates/post_helper.tmpl b/nikola/data/themes/base/templates/post_helper.tmpl index 424d134..9ae4489 100644 --- a/nikola/data/themes/base/templates/post_helper.tmpl +++ b/nikola/data/themes/base/templates/post_helper.tmpl @@ -1,9 +1,10 @@ ## -*- coding: utf-8 -*- +<%namespace name="math" file="math_helper.tmpl"/> <%def name="meta_translations(post)"> %if len(translations) > 1: %for langname in sorted(translations): - %if langname != lang and post.is_translation_available(langname): + %if langname != lang and ((not post.skip_untranslated) or post.is_translation_available(langname)): <link rel="alternate" hreflang="${langname}" href="${post.permalink(langname)}"> %endif %endfor @@ -15,7 +16,7 @@ <ul itemprop="keywords" class="tags"> %for tag in post.tags: % if tag not in hidden_tags: - <li><a class="tag p-category" href="${_link('tag', tag)}" rel="tag">${tag}</a></li> + <li><a class="tag p-category" href="${_link('tag', tag)}" rel="tag">${tag|h}</a></li> % endif %endfor </ul> @@ -40,31 +41,29 @@ </%def> <%def name="open_graph_metadata(post)"> -%if use_open_graph: - <meta property="og:site_name" content="${blog_title|striphtml}"> - <meta property="og:title" content="${post.title()[:70]|h}"> - <meta property="og:url" content="${abs_link(permalink)}"> - %if post.description(): +<meta property="og:site_name" content="${blog_title|h}"> +<meta property="og:title" content="${post.title()[:70]|h}"> +<meta property="og:url" content="${abs_link(permalink)}"> +%if post.description(): <meta property="og:description" content="${post.description()[:200]|h}"> - %else: +%else: <meta property="og:description" content="${post.text(strip_html=True)[:200]|h}"> - %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()}"> +### <meta property="article:author" content="${post.author()|h}"> ### %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}"> - %endfor - %endif +%endif +%if post.tags: + %for tag in post.tags: + <meta property="article:tag" content="${tag|h}"> + %endfor %endif </%def> @@ -84,10 +83,7 @@ %endif </%def> +### This function is deprecated; use math_helper directly. <%def name="mathjax_script(post)"> - %if post.is_mathjax: - <script type="text/x-mathjax-config"> - MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});</script> - <script src="/assets/js/mathjax.js"></script> - %endif + ${math.math_scripts_ifpost(post)} </%def> |
