[구글 블로거] 최신글 위젯 만들기
구글 블로거에 최신글 위젯 만들기
인기글을 보여주는 위젯은 기본적으로 제공되는데 반해 최신글을 보여주는 위젯은 없어 HTML/java Script를 통해서 만들 수 있습니다.
최신글 위젯 만드는 방법
#1. 우선 "레이아웃"에 들어가서 "가젯 추가"하기를 클릭합니다.
#2. 가젯 추가에서 "HTML/java Script"를 선택합니다.
#3. 아래 코드를 복사해서 "HTML/java Script"에 붙여넣기를 하고 주황색으로 표시한 부분에 자신의 블로거 주소를 넣고 저장하시면 됩니다.
12345678910 <div id="hlrpsb"><script type="text/javascript">function showrecentposts(t){for(var e=0;e<numposts;e++){var n,r=t.feed.entry[e],i=r.title.$t;if(e==t.feed.entry.length)break;for(var d=0;d<r.link.length;d++)if("alternate"==r.link[d].rel){n=r.link[d].href;break}i=i.link(n);var s=r.published.$t,a=s.substring(0,4),o=s.substring(5,7),l=s.substring(8,10),u=new Array;u[1]="Jan",u[2]="Feb",u[3]="Mar",u[4]="Apr",u[5]="May",u[6]="Jun",u[7]="Jul",u[8]="Aug",u[9]="Sep",u[10]="Oct",u[11]="Nov",u[12]="Dec",standardstyling||document.write(""),document.write('<div class="rctitles2">'),standardstyling&&document.write(""),document.write(i),standardstyling&&document.write(""),1==showpostdate&&document.write(" - "+l+" "+u[parseInt(o,10)]+" "+a),standardstyling||document.write("</div>"),document.write("</div>"),standardstyling&&document.write("")}standardstyling||document.write('<div class="bbwidgetfooter">'),standardstyling&&document.write(""),document.write(""),standardstyling||document.write("/div")}</script><script type="text/javascript">var numposts = 10;var showpostdate = false;var standardstyling = true;</script><script src="http://blog-address.blogspot.com/feeds/posts/default?orderby=published&alt=json-in-script&callback=showrecentposts"></script></div><a style="font-size: 9px; color: #CECECE; float: right; margin-top: 10px;" href="http://helplogger.blogspot.com/2012/04/recent-posts-widget-for-bloggerblogspot.html" rel="nofollow" >Recent Posts Widget</a><noscript>Oops! Make sure JavaScript is enabled in your browser.</noscript><style type=text/css>#hlrpsb a {color: #000000;font-size:13px;text-transform:capitalize;}.rctitles2 {padding-bottom:10px;margin-bottom:10px;border-bottom: 1px dotted #cccccc;}</style>cs
#4. 추가로 옵션 조정하는 방법입니다.
numposts = 10 : 최신글 10개를 표시한다는 뜻으로 원하는 숫자를 입력하시면 됩니다.
showpostdate = false : 최신글의 게시날짜를 표시하지 유무이며 true로 변경하시면 게시날짜도 같이 보여줍니다.
오른쪽 하단에 있는 "이메일 구독"이나 "팔로워"를 하시면
블로그 게시물을 빨리 받아보실 수 있습니다.
댓글 쓰기
0 댓글