구글 블로그스팟 페이지에 라벨 목록 만들기 출력
페이지에 라벨 전부를 목록으로 출력하겠다고 검색하고, 오름차순으로 정렬하는 방법을 찾아서 적용을 시켰습니다. 포스트 숫자 출력하는 것까지는 못 찾아서 포기했습니다.
■ 소스 코드
■ 결과물 이미지
참고 링크 : MBT Blogger
■ 소스 코드
복사하기(copy)
<script type="text/javascript">
function AllLabel(json) {
var arr = [ ];
for (var i = 0; i < json.feed.category.length; i++) {
arr[i] = "<li><a href='https://블로그주소이름.blogspot.com/search/label/" + json.feed.category[i].term + "'>"+json.feed.category[i].term+"</a></li>";
}
arr.sort();
var list = "<H2>라벨 목록</H2>"+arr.join('');
document.write(list);
}
</script>
<script type="text/javascript" src="https://블로그주소이름.blogspot.com/feeds/posts/default?alt=json-in-script&callback=AllLabel">
</script>
<style>
li {border-bottom: 1px dotted #ddd; margin: 5px 0; padding: 5px; width: 250px;}
a { text-decoration:none }
</style>
빨간색으로 표시한 부분에 사용자의 구글 블로그스팟 주소를 넣으세요.
function AllLabel(json) {
var arr = [ ];
for (var i = 0; i < json.feed.category.length; i++) {
arr[i] = "<li><a href='https://블로그주소이름.blogspot.com/search/label/" + json.feed.category[i].term + "'>"+json.feed.category[i].term+"</a></li>";
}
arr.sort();
var list = "<H2>라벨 목록</H2>"+arr.join('');
document.write(list);
}
</script>
<script type="text/javascript" src="https://블로그주소이름.blogspot.com/feeds/posts/default?alt=json-in-script&callback=AllLabel">
</script>
<style>
li {border-bottom: 1px dotted #ddd; margin: 5px 0; padding: 5px; width: 250px;}
a { text-decoration:none }
</style>
■ 결과물 이미지
참고 링크 : MBT Blogger
Comments
Post a Comment