将Jekyll post数据与YAML的数据相结合,生成一个新的博客提要
我想我甚至不知道我应该寻找什么。在我的博客上,我目前只写了一些博客文章,并在主页上列出了它们的全部内容,并使用分页。我想遵循更多的独立网站标准,并遵循(在别处发布,联合(到你自己的)网站)的方法。我已经找到了一种方法,可以从我的推特上自动将数据(如发布日期、嵌入代码等)放入YAML数据文件中。我想做的是从我的帖子中获取数据,并将来自Twitter的数据组合起来,将这些帖子当作博客帖子(Instagram的计划也是如此) 我已经尝试了很多事情,但我甚至不确定做这件事的最佳方式是什么。我假设它将使用类似的东西,但我似乎无法使它工作。目前,我的博客帖子代码如下:将Jekyll post数据与YAML的数据相结合,生成一个新的博客提要,jekyll,github-pages,indieweb,Jekyll,Github Pages,Indieweb,我想我甚至不知道我应该寻找什么。在我的博客上,我目前只写了一些博客文章,并在主页上列出了它们的全部内容,并使用分页。我想遵循更多的独立网站标准,并遵循(在别处发布,联合(到你自己的)网站)的方法。我已经找到了一种方法,可以从我的推特上自动将数据(如发布日期、嵌入代码等)放入YAML数据文件中。我想做的是从我的帖子中获取数据,并将来自Twitter的数据组合起来,将这些帖子当作博客帖子(Instagram的计划也是如此) 我已经尝试了很多事情,但我甚至不确定做这件事的最佳方式是什么。我假设它将使用
{% for post in paginator.posts %}
{% if post.header.teaser %}
{% capture teaser %}{{ post.header.teaser }}{% endcapture %}
{% else %}
{% assign teaser = site.teaser %}
{% endif %}
{% if post.id %}
{% assign title = post.title | markdownify | remove: "<p>" | remove: "</p>" %}
{% else %}
{% assign title = post.title %}
{% endif %}
<div class="list__item">
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
<h1 class="archive__item-title" itemprop="headline">
{% if post.link %}
<a href="{{ post.link }}">{{ title }}</a> <a href="{{ post.url | relative_url }}" rel="permalink"><i class="fas fa-link" aria-hidden="true" title="permalink"></i><span class="sr-only">Permalink</span></a>
{% else %}
<a href="{{ post.url | relative_url }}" rel="permalink">{{ title }}</a>
{% endif %}
</h1>
<p>Posted on <a href="{{ post.url }}">{{ post.date | date: "%A %B %-d, %Y" }}</a> by <a href="/contact/">Jacob Campbell</a>.</p>
{{ post.content }}
</article>
</div>
{% endfor %}
{% include paginator.html %}
{paginator.posts%中的post为%s}
{%if post.header.trister%}
{%capture-trister%}{{post.header.trister}}{%endcapture%}
{%else%}
{%assign STREASTER=site.STREASTER%}
{%endif%}
{%if post.id%}
{%assign title=post.title | markdownify | remove:“”| remove:“”%}
{%else%}
{%assign title=post.title%}
{%endif%}
{%else%}
{%endif%}
张贴于
{{post.content}}
{%endfor%}
{%include paginator.html%}
也许,如果你的帖子和推文在字段方面有相同的结构,你可以选择这两个:
{%comment%}假设您将tweets作为一个集合从站点访问,例如{%endcomment%}
{%assign posts=paginator.posts | concat:site.tweets | sort:“date”%}
{posts%%中的post为%s}
{{post.title}}
{{post.content}}
{%endfor%}
注意,这里我也通过过滤器在concat
之后重新列出tweet,因此tweet确实会出现在帖子的正常时间序列中
如果你的结构不一样,你可以总是求助于你的帖子是:
{%assign posts=paginator.posts | concat:site.tweets | concat:site.instagram | sort:“date”}
{posts%%中的post为%s}
{%if post.collection='posts%}
{{post.title}}
{{post.content}}
{%elsif post.collection=='tweets%}
{%comment%}如果我没有弄错的话,twitter没有标题概念{%endcomment%}
有一只鸟在唱:
{{post.content}}
{%elsif post.collection=='instagram%}
{%comment%}现在,它可以适合您选择的任何社交媒体{%endcomment%}
{%endif%}
{%endfor%}
也许,如果你的帖子和推文在字段方面有相同的结构,你可以选择这两个:
{%comment%}假设您将tweets作为一个集合从站点访问,例如{%endcomment%}
{%assign posts=paginator.posts | concat:site.tweets | sort:“date”%}
{posts%%中的post为%s}
{{post.title}}
{{post.content}}
{%endfor%}
注意,这里我也通过过滤器在concat
之后重新列出tweet,因此tweet确实会出现在帖子的正常时间序列中
如果你的结构不一样,你可以总是求助于你的帖子是:
{%assign posts=paginator.posts | concat:site.tweets | concat:site.instagram | sort:“date”}
{posts%%中的post为%s}
{%if post.collection='posts%}
{{post.title}}
{{post.content}}
{%elsif post.collection=='tweets%}
{%comment%}如果我没有弄错的话,twitter没有标题概念{%endcomment%}
有一只鸟在唱:
{{post.content}}
{%elsif post.collection=='instagram%}
{%comment%}现在,它可以适合您选择的任何社交媒体{%endcomment%}
{%endif%}
{%endfor%}