1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-19 06:06:54 +00:00

fix: correct the Twitter Card in social share preview (#1498)

---------

Co-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
This commit is contained in:
bigsk1
2024-01-27 13:53:54 -08:00
committed by GitHub
parent 1127c43823
commit 74f16623c9
2 changed files with 20 additions and 8 deletions

View File

@@ -2,8 +2,9 @@
Generate image final URL based on `site.img_cdn`, `page.img_path`
Arguments:
src - basic image path, required
img_path - relative path of image, optional
src - required, basic image path
img_path - optional, relative path of image
absolute - optional, boolean, if true, generate absolute URL
Return:
image URL
@@ -14,7 +15,7 @@
{%- if url -%}
{% unless url contains ':' %}
{%- comment -%} CND URL {%- endcomment -%}
{% assign prefix = site.img_cdn | default: '' | relative_url %}
{% assign prefix = site.img_cdn | default: '' %}
{%- comment -%} Add page image path prefix {%- endcomment -%}
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
@@ -26,6 +27,12 @@
| replace: '//', '/'
| replace: ':', ':/'
%}
{% if include.absolute %}
{% assign url = url | absolute_url %}
{% else %}
{% assign url = url | relative_url %}
{% endif %}
{% endunless %}
{%- endif -%}