【问题标题】:How to add an image for Twitter cards on with posts with Jekyll-seo-tag?如何在带有 Jekyll-seo-tag 的帖子上为 Twitter 卡片添加图像?
【发布时间】:2019-07-10 12:21:22
【问题描述】:

将 Jekyll 与 Github 页面结合使用,当我在 Twitter 上分享帖子时,Twitter Card 中不会显示任何图像。

我使用 Jekyll-seo-tag,但是在 Front Matter 中添加图像标签时它不起作用,当我转到相应的 URL 时,我得到的是 404 而不是帖子。

我尝试了什么:

---
layout: post
title:  "lorem ispum - Week 22 of 2018"
subtitle: "An inside look at ...."
date:   2018-06-04 17:00:00
authors: [ John Doe ]
icon: icon-calendar
tags:
 - core-weekly
image: /assets/images/2017/04/...
---

【问题讨论】:

    标签: image twitter jekyll meta twitter-card


    【解决方案1】:

    找到问题了。

    image 标签不应位于 Front Matter 的最后一个位置。

    当我把它放在中间时,它会工作,我会在 Twitter 卡上看到图像。

    见下文:

    ---
    layout: post
    title:  "lorem ispum - Week 22 of 2018"
    subtitle: "An inside look at ...."
    date:   2018-06-04 17:00:00
    authors: [ John Doe ]
    image: /assets/images/2017/04/...
    icon: icon-calendar
    tags:
     - core-weekly
    ---
    

    【讨论】:

    • 您的结论具有误导性。如果您在前面事项的最后有 image 键并不重要。问题可能在于缩进,因为 YAML 对缩进很敏感。我建议您重新检查并编辑您的答案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-13
    • 2020-08-27
    • 1970-01-01
    • 2023-01-03
    • 2011-06-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多