diff --git a/templates/macros/hooks.html b/templates/macros/hooks.html index 0ceba70..0fe3dd4 100644 --- a/templates/macros/hooks.html +++ b/templates/macros/hooks.html @@ -7,4 +7,21 @@ {% macro posts_below_title(page) %} {{page.description}} -{% endmacro posts_below_title %} \ No newline at end of file +{% endmacro posts_below_title %} + + + +{% macro og_image_tags() %} +{%- if page.extra.og_preview_img -%} +{%- set_global url = get_url(path=page.extra.og_preview_img) | safe -%} +{%- endif -%} + +{%- if url -%} + +{# + + +#} +{%- endif -%} + +{% endmacro og_image_tags %} diff --git a/templates/macros/images.html b/templates/macros/images.html index f8c1d0f..7a3fcd6 100644 --- a/templates/macros/images.html +++ b/templates/macros/images.html @@ -38,6 +38,25 @@ {% endmacro responsive_image -%} +{% macro responsive_image_url(path, src, width, height, op="fill") -%} +{% if config.extra.image_resizing_disabled and config.extra.image_resizing_disabled == true -%} +{# ZOLA BUG? Can't use get_url doesn't work here... as this fails for some reason... #} +{# {{ alt }} + #} +/inky.png +{% else -%} + {% set abspath = path ~ src -%} + {% set meta = get_image_metadata(path=abspath) -%} + {% set current_width = meta.width -%} + + {# {% if current_width >= width -%} #} + {% set resized = resize_image(format=config.extra.image_format, path=abspath, width=width, height=height, op=op, quality=config.extra.image_quality) -%} + {{ resized.url | safe }} + {# {% endif -%} #} +{% endif -%} +{% endmacro responsive_image_url -%} + + {% macro responsive_thumbnail(path, src, alt, default_size, sizes, class="") -%} {% if config.extra.image_resizing_disabled and config.extra.image_resizing_disabled == true -%} {# {{ alt }} #} diff --git a/templates/macros/opengraph.html b/templates/macros/opengraph.html index 66a94d9..aeec31a 100644 --- a/templates/macros/opengraph.html +++ b/templates/macros/opengraph.html @@ -8,13 +8,7 @@ - - - - - - - +{{hooks::og_image_tags() }} {% endmacro og_preview %} @@ -59,9 +53,3 @@ {%- else -%}{{ config.description }}{%- endif -%} {%- endif -%} {% endmacro og_title %} - -{% macro og_image() %} -{%- if page.extra.og_preview_img -%} -{{ get_url(path=page.extra.og_preview_img) | safe }} -{%- endif -%} -{% endmacro og_image %}