/modules/mod_seo/templates/_html_head.tpl

http://github.com/zotonic/zotonic · Smarty Template · 57 lines · 56 code · 1 blank · 0 comment · 21 complexity · df30e4c6fc2d25a618fc472f6082598b MD5 · raw file

  1. {% if id %}
  2. <link rel="shorturl" href="{% url id id=id %}" />
  3. <link rel="canonical" href="{{ m.rsc[id].page_url }}" />
  4. {% endif %}
  5. {% if m.config.seo.noindex.value or noindex %}
  6. <meta name="robots" content="noindex,nofollow" />
  7. {% elseif id and id.language and m.modules.active.mod_translation and not z_language|member:id.language %}
  8. {# Take one of the alternative urls, provided by mod_translation #}
  9. <meta name="robots" content="noindex" />
  10. {% else %}
  11. {% with m.config.seo.keywords.value as keywords %}
  12. {% with m.config.seo.description.value as description %}
  13. {% if id %}
  14. {% if m.rsc[id].seo_noindex %}
  15. {% if not m.config.seo.noindex.value %}<meta name="robots" content="noindex" />{% endif %}
  16. {% else %}
  17. {% with m.rsc[id].seo_keywords as seo_keywords %}
  18. {% if seo_keywords %}
  19. <meta name="keywords" content="{{ seo_keywords }}, {{ keywords }}" />
  20. {% else %}
  21. <meta name="keywords" content="{% for predicate in id.op %}{% if predicate /= "depiction" %}{% for oid in id.o[predicate] %}{{ oid.title }}, {% endfor %}{% endif %}{% endfor %}{{ keywords }}" />
  22. {% endif %}
  23. <meta name="description" content="{{ id.seo_desc|default:id.summary|default:description|escape }}" />
  24. {% endwith %}
  25. {% endif %}
  26. {% else %}
  27. {% if keywords %}
  28. <meta name="keywords" content="{{ keywords }}" />
  29. {% endif %}
  30. {% if description %}
  31. <meta name="description" content="{{ description }}" />
  32. {% endif %}
  33. {% endif %}
  34. {% endwith %}
  35. {% endwith %}
  36. {% endif %}
  37. {% with m.config.seo_bing.webmaster_verify.value as wmv %}{% if wmv %}
  38. <meta name="msvalidate.01" content="{{ wmv }}" />
  39. {% endif %}{% endwith %}
  40. {% with m.config.seo_google.webmaster_verify.value as wmv %}{% if wmv %}
  41. <meta name="google-site-verification" content="{{ wmv }}" />
  42. {% endif %}{% endwith %}
  43. {% if m.acl.user /= 1 and not notrack %}
  44. {% with m.config.seo_google.analytics.value as ga %}{% if ga %}
  45. <script>
  46. window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
  47. {% if m.acl.user %}
  48. ga('create', "{{ ga|escapejs }}", 'auto', { userId: "{{ m.acl.user|escapejs }}" });
  49. {% else %}
  50. ga('create', "{{ ga|escapejs }}", 'auto');
  51. {% endif %}
  52. ga('send', 'pageview');
  53. </script>
  54. <script async src='https://www.google-analytics.com/analytics.js'></script>
  55. {% endif %}{% endwith %}
  56. {% endif %}