diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index b6c8674..614139f 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -13,7 +13,7 @@ cdns: # fonts -webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;700;900&display=swap +webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Source+Sans+Pro:wght@400;600;700;900&display=swap # Libraries diff --git a/_includes/post-description.html b/_includes/post-description.html new file mode 100644 index 0000000..6c40036 --- /dev/null +++ b/_includes/post-description.html @@ -0,0 +1,16 @@ +{%- comment -%} + Get post description or generate it from the post content. +{%- endcomment -%} + +{%- assign max_length = include.max_length | default: 200 -%} + +{%- capture description -%} +{%- if post.description -%} + {{- post.description -}} +{%- else -%} + {%- include no-linenos.html content=post.content -%} + {{- content | markdownify | strip_html -}} +{%- endif -%} +{%- endcapture -%} + +{{- description | strip | truncate: max_length | escape -}} diff --git a/_includes/related-posts.html b/_includes/related-posts.html index 1ba2f32..ae39da4 100644 --- a/_includes/related-posts.html +++ b/_includes/related-posts.html @@ -81,10 +81,7 @@ {% include datetime.html date=post.date lang=include.lang %}

{{ post.title }}

-

- {% include no-linenos.html content=post.content %} - {{ content | markdownify | strip_html | truncate: 200 | escape }} -

+

{% include post-description.html %}

diff --git a/_layouts/home.html b/_layouts/home.html index 4cf4c1d..a9f5bd3 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -72,10 +72,7 @@ refactor: true

{{ post.title }}

-

- {% include no-linenos.html content=post.content %} - {{ content | markdownify | strip_html | truncate: 200 | escape }} -

+

{% include post-description.html %}

diff --git a/_layouts/post.html b/_layouts/post.html index f666d71..f17ceea 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -14,6 +14,9 @@ tail_includes:

{{ page.title }}

+ {% if page.description %} +

{{ page.description }}

+ {% endif %}