在互联网上,我从Json-LD文章下面得到了这段代码,但我不知道我必须在字段中添加什么代码:
[Article title]
[Article sub heading]
[Main article image url]
[Author name]
[Date in ISO format e.g. 2014-03-16]
[Article summary]
我也不知道,我必须在模板的哪个部分放置。我对编程一无所知。
请你帮我把json-ld文章放在contempo blogger模板
中
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"headline": "[article title]",
"alternativeHeadline": "[article sub heading]",
"image": "[main article image url]",
"author": "[author name]",
"datePublished": "[date in ISO format e.g. 2014-03-16]",
"description": "[article summary]"
}
</script>
&#13;
答案 0 :(得分:0)
在Blogger发布的新主题中(如您正在使用的Contempo主题),它们包含了一个新的数据标记,用于自动生成帖子的JSON-LD数据。负责此事的标签是 -
<b:include data='post' name='postMetadataJSON'/>
默认情况下会生成以下数据 -
<script type='application/ld+json'>
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "POST-URL"
},
"headline": "POST TITLE",
"description": "POST SNIPPET",
"datePublished": "DATE-PUBLISHED",
"dateModified": "DATE-MODIFIED",
"image": {
"@type": "ImageObject",
"url": "IMAGE-URL",
"height": 630,
"width": 1200
},
"publisher": {
"@type": "Organization",
"name": "Blogger",
"logo": {
"@type": "ImageObject",
"url": "BLOGGER-LOGO",
"width": 206,
"height": 60
}
},
"author": {
"@type": "Person",
"name": "AUTHOR NAME"
}
}
</script>
默认情况下,此标记包含在所有新主题中,因此您无需从侧面添加标记。
答案 1 :(得分:0)
您可以通过在iterate-patterns() {
tempfile=$(mktemp /tmp/patterns.XXXXXX)
tempfile2=$(mktemp /tmp/patterns2.XXXXXX)
cat > "$tempfile"
for i in "${patterns[@]}"
do
if [[ "$i" = *-red ]]
then
GREP_COLOR="$RED" grep -E --text --color=always --line-buffered -f /var/lib/foobar/"${i}".txt "$tempfile" > "$tempfile2"
elif [[ "$i" = *-yellow ]]
then
GREP_COLOR="$YELLOW" grep -E --text --color=always --line-buffered -f /var/lib/foobar/"${i}".txt "$tempfile" > "$tempfile2"
elif [[ "$i" = *-green ]]
then
GREP_COLOR="$GREEN" grep -E --text --color=always --line-buffered -f /var/lib/foobar/"${i}".txt "$tempfile" > "$tempfile2"
else
cat "$tempfile" > "$tempfile2"
fi
cp "$tempfile2" "$tempfile"
done
cat "$tempfile"
rm "$tempfile" "$tempfile2"
}
之后放置代码来制作自定义主题
<b:includable id='post' var='post'>
示例
<b:includable id='post' var='post'>
<script type='application/ld+json'>
<-- ld json content -->
</script>
<-- other code -->
查看This Article以获得详细说明。