gpt4 book ai didi

blogger - 如何使用图像在博主帖子中创建帖子列表

转载 作者:行者123 更新时间:2023-12-04 10:48:46 26 4
gpt4 key购买 nike

您好,我正在尝试为类似类别创建帖子列表,但我不知道如何创建带有图像和描述的列表,如下所示 -

我尝试创建但数据格式不正确,您可以在以下屏幕截图中看到-

enter image description here

最佳答案

<style type='text/css'>/*<![CDATA[*/
.post {
margin-bottom: 10px;
padding-bottom: 10px;
border-bottom: 1px solid #EEE;
overflow: hidden;
font-family: tahoma;
}
.post-thumb {
float: left;
margin-right: 10px;
border: 3px solid #fff;
box-shadow: 0 0 1px #000;
}
.post-title {
margin: 0 0 5px;
line-height: 12px
}
.post-title a {
font-size: 12px;
color: #222;
text-decoration: none
}
.post-title a:hover{
color: coral;
text-decoration: underline
}
.post-snippet{
font-size: 12px;
color: #666;
margin: 5px 0;
}
.post-date {
font-size: 12px;
color: #999;
}
/*]]>*/</style>

<div id='posts'></div>

<script type='text/javascript'>/*<![CDATA[*/
function FeedPosts(jsondata){
if(jsondata.feed.entry){
var markup='';
for( var p=0; p < jsondata.feed.entry.length; p++){
var item = jsondata.feed.entry[p],
thumbnail = item['media$thumbnail'] ? item['media$thumbnail'].url.replace(/s72-c/, 'w150-h80-p') : '',
title = item.title.$t,
link = item.link.filter(function(l){ return l.rel == 'alternate' })[0].href,
snippet = item.content.$t.replace(/<\/?[^>]+(>|$)/g, '').substr(0, 80) + '...',
date = new Date(item.published.$t).toLocaleDateString();
markup += '<div class="post">';
markup += thumbnail ? '<img class="post-thumb" src="'+ thumbnail +'">' : '';
markup += '<h2 class="post-title"><a href="'+ link +'">'+ title +'</a></h2>';
markup += '<p class="post-snippet">'+ snippet +'</p>';
markup += '<abbr class="post-date">'+ date +'</abbr>';
markup += '</div>';
}
document.querySelector('#posts').innerHTML = markup;
}
}
/*]]>*/</script>

<!-- Replace "6224600608277196834" with your blog id -->
<!-- OR Replace script source with "/feeds/posts/default/-/Reactions?alt=json-in-script&max-results=5&callback=FeedPosts" -->
<!-- Replace "Reactions" with your category name -->
<script src="https://www.blogger.com/feeds/6224600608277196834/posts/default/-/Reactions?alt=json-in-script&max-results=5&callback=FeedPosts"></script>

关于blogger - 如何使用图像在博主帖子中创建帖子列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59580758/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com