Blogger 自選焦點 分類文章 文章列表

Blogger 自選焦點 分類文章

Blogspot的「熱門文章」小工具,要顯示的文章,是由訪客來決定 ~
而精選文章也只能選一個,若想要能自選多個得意的聚焦文章、就要自已動手來建立嚕!!

 首先 >> 進入文章管理頁面,利用標籤來建立分類文章,點按右上角 > 管理,
快速的來作大量的批次處理 ...


接下來、點按下面的 Code 複製 XML碼:

<b:widget id='TextList122' locked='false' mobile='yes' title='自選熱門文章' type='TextList' version='2' visible='true'>
<b:includable id='main'>
<b:include name='content'/>
<b:include name='script'/>
</b:includable>
<b:includable id='content'>
<div class='hot-post'>
<article class='art'>
<h3 class='entry-title'>
<a href=''/>
</h3>
<div class='post-header'/>
<div class='entry-content'>
<a href=''>
<div class='s-thum'/>
</a>
<div class='s-item'/>
</div>
<div class='post-bottom'>
<span class='num_comments'/>
<div class='jump-link'>
<a href=''>
閱讀完整 內容 &#187;
</a>
</div>
</div>
</article>
</div>
</b:includable>
<b:includable id='script'>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js'/>
<script type='text/javascript'>
$(function() {
var url = &quot;<data:blog.homepageUrl/>feeds/posts/default?category=<b:eval expr='data:items[0]'/>&amp;alt=json-in-script&amp;max-results=<data:shownum/>&quot;;
var cont = '#<data:widget.instanceId/> .hot-post';
// <![CDATA[
$.ajax({
url: url ,
type: 'get',
dataType: 'jsonp',
success: xson,
error: function() {
$(cont).html(
'<strong>系統不正常</strong>')}
});
var x=$('article.art');
function xson(data) {
var tent = data.feed.entry, temp='';
if (!tent) { $(cont).html('<span>沒文章 下載</span>'); return(0);}
for ( i in tent) {
const y=tent[i];
x.find('.entry-title a').html(y.title.$t);
x.find('.publ').html(y.published.$t.replace(/[T].*/,""));
x.find('a').attr('href',y.link[4].href);
x.find('.s-thum').html(y.content.$t.match(/<img\S*.[^>]*>/));
x.find('.s-item').html(y.content.$t.replace(/<\S[^>]*>/g,"").substr(0,200));
x.find('.num_comments').html('留言(' + y.thr$total.$t +')');
if(i < tent.length-1){x.clone().prependTo(cont);}
}
} });
// ]]>
</script>
<!--樣式不滿意; 可自已改; 若要安裝多個; CSS樣式只要保留一份就可以-->
<style type='text/css'>
.hot-post .art{margin:20px 10px; border:1px solid #aaa; padding:10px;
overflow:hidden;box-shadow:1px 1px 10px rgba(50,50,50,0.5);}
.hot-post .s-thum{ width:35%; max-width:380px;margin:10px;float:left; overflow:hidden;}
.hot-post .s-thum img{ transition: .6s;}
.hot-post .art:hover .s-thum img{ opacity:0.8; transform:scale(1.2)}
.hot-post .s-item{ padding: 30px;}
.hot-post .post-bottom{ clear:both; margin: 0 auto; width: 250px;}
.hot-post .num_comments{margin:2px 30px;}
</style>
</b:includable>
</b:widget>



按主題  >> 在模板的 HTML 編輯器中添加代碼:

假如、你對範本不太了解,不知要貼在哪裡? 你可以先在版面配置,任何區塊新增一個文字清單。
再轉到 HTML 編輯器中,按右上角 >> 跳到小工具,找到剛剛新增的文字清單小工具

找到小部件(小工具)後,在左邊的行號後有一個3角型符號,按下後會收合成一行,你就可以在上一行,貼上小工具HTML碼了 ! 或反白、替代。



儲存模板後,轉到 [版面配置]窗格,將其移動到你想放置的地方。

編輯文字清單

在 [版面配置]窗格 ~ 打開文字清單小工具,在設置中設定要顯示的文章數,
標籤只會使用到第一行,你可以輸入多組,以後可以輪番上陣。



注 1:倘若你已有安裝 ( jquery ) 函數庫,請刪除這行 ~  <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js'/>

   注 2:在 設定 》 網站資訊提供 ~ 允許網誌動態消息 》 ( 要設定成 ) 》完整



樣 式


留言 ( 4 )

張貼留言




           

預 覽 視 窗

新舊排序 :

    © Copyright 2021 Design By 灰鴿   技術堤供 : Blogger