Sunday, 8 October 2017
RELATED POST WIDGET LIST WITHOUT THUMBNAIL
-------------------------------------------------------------------------------------------------------
FIND HEAD </head> TAG AND PASTE BELOW CODE
WHEN WE WRITE JAVA SCRIPT UNDER B TAG IT DOESN'T SHOW
IN VIEW PAGE SOURCE
--------------------------------------------------------------------------------------------------------
<b:if cond='data:blog.pageType
== "item"'>
<style type='text/css'>
.related-post-title {
font-size: 2.3em;
margin: 5px 0px;
}
#related-posts {
margin: 0px 5px;
}
#related-posts a {
font-size: 1.1em;
color: #970E0E;
text-transform: capitalize;
}
#related-posts a:hover {
text-decoration: none;
color: #555;
}
#related-posts ul {
list-style-type: none;
padding: 0px;
color: #000000;
}
#related-posts li {
padding: 0.7em 1.2em;
border-bottom: 1px solid #E2E2E2;
background:
url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigmRFeKa54vjLl487wFjHujqSoPhnrHpzkusRkJpQctknnf3XHlMKlA6tTmft87HkgejMAiy5LDclXS_KiKuE7gAKV2h6GB8zTcKk8IrOx9ZiAgkXZCPHVAwieme47A7yphTvVDvQHwgs/s1600/Arrow.png).2em
1em no-repeat;
}
#related-posts li:hover {
background:
url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigmRFeKa54vjLl487wFjHujqSoPhnrHpzkusRkJpQctknnf3XHlMKlA6tTmft87HkgejMAiy5LDclXS_KiKuE7gAKV2h6GB8zTcKk8IrOx9ZiAgkXZCPHVAwieme47A7yphTvVDvQHwgs/s1600/Arrow.png).2em
1em no-repeat #E7F0FF;
}
</style>
<script src='http://aireshalili.github.io/internetsmash/simple-related-post.js' type='text/javascript'/>
</b:if>
</head>
-------------------------------------------------------------------------------------------------------
simple-related-post.js CODE
http://aireshalili.github.io/internetsmash/simple-related-post.js
-------------------------------------------------------------------------------------------------------
var relatedTitles = new Array();
var relatedTitlesNum = 0;
var relatedUrls = new Array();
function related_results_labels(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
var entry = json.feed.entry[i];
relatedTitles[relatedTitlesNum] = entry.title.$t;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
relatedUrls[relatedTitlesNum] = entry.link[k].href;
relatedTitlesNum++;
break
}
}
}
}
function removeRelatedDuplicates() {
var tmp = new Array(0);
var tmp2 = new Array(0);
for (var i = 0; i < relatedUrls.length; i++) {
if (!contains(tmp, relatedUrls[i])) {
tmp.length += 1;
tmp[tmp.length - 1] = relatedUrls[i];
tmp2.length += 1;
tmp2[tmp2.length - 1] = relatedTitles[i]
}
}
relatedTitles = tmp2;
relatedUrls = tmp
}
function contains(a, e) {
for (var j = 0; j < a.length; j++) {
if (a[j] == e) {
return true
}
};
return false
}
function printRelatedLabels(currenturl) {
for (var i = 0; i < relatedUrls.length; i++) {
if (relatedUrls[i] == currenturl) {
relatedUrls.splice(i, 1);
relatedTitles.splice(i, 1)
}
}
var r = Math.floor((relatedTitles.length - 1) * Math.random());
var i = 0;
if (relatedTitles.length > 1) {
document.write()
}
document.write('<ul>');
while (i < relatedTitles.length && i < 20 && i < maxresults) {
document.write('<li><a href="' + relatedUrls[r] + '">' + relatedTitles[r] + '</a></li>');
if (r < relatedTitles.length - 1) {
r++
} else {
r = 0
}
i++
}
document.write('</ul>');
relatedUrls.splice(0, relatedUrls.length);
relatedTitles.splice(0, relatedTitles.length);
}
-------------------------------------------------------------------------------------------------------
FIND POST INCLUDABLE LINE
<b:includable id='post' var='post'>
FIND POST FOOTER LINE
<div class='post-footer'>
ADD BELOW HTML CODE
-------------------------------------------------------------------------------------------------------
<!-- Ralated post Start -->
<b:if cond='data:blog.pageType == "item"'>
<div id='related-posts'>
<h4 class='related-post-title'>You may also like</h4>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast != "true"'>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<script expr:src='"/feeds/posts/default/-/" +
data:label.name + "?alt=json-in-script&callback=related_results_labels&max-results=5"' type='text/javascript'/>
</b:if>
</b:loop>
<script type='text/javascript'>
var maxresults=5; removeRelatedDuplicates();
printRelatedLabels("<data:post.url/>");
</script>
</div>
</b:if>
<!-- END Ralated -->
-------------------------------------------------------------------------------------------------------
OR USE THIS METHOD
http://pendopo2.blogspot.co.uk/2011/12/membuat-related-post-widget.html
-------------------------------------------------------------------------------------------------------
OR USE THIS METHOD
http://pendopo2.blogspot.co.uk/2011/12/membuat-related-post-widget.html
-------------------------------------------------------------------------------------------------------
<script type="text/javascript">
//<![CDATA[
var relatedTitles = new Array();
var relatedTitlesNum = 0;
var relatedUrls = new Array();
function related_results_labels(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
var entry = json.feed.entry[i];
relatedTitles[relatedTitlesNum] =
entry.title.$t;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel
== 'alternate') {
relatedUrls[relatedTitlesNum] =
entry.link[k].href;
relatedTitlesNum++;
break;
}
}
}
}
function removeRelatedDuplicates() {
var tmp = new Array(0);
var tmp2 = new Array(0);
for(var i = 0; i < relatedUrls.length; i++)
{
if(!contains(tmp, relatedUrls[i]))
{
tmp.length += 1;
tmp[tmp.length - 1] = relatedUrls[i];
tmp2.length += 1;
tmp2[tmp2.length - 1] = relatedTitles[i];
}
}
relatedTitles = tmp2;
relatedUrls = tmp;
}
function contains(a, e) {
for(var j = 0; j < a.length; j++) if (a[j]==e) return true;
return false;
}
function printRelatedLabels() {
var r = Math.floor((relatedTitles.length - 1) * Math.random());
var i = 0;
document.write('<ul>');
while (i < relatedTitles.length && i <
20) {
document.write('<li><a
href="' + relatedUrls[r] + '">' + relatedTitles[r] + '</a></li>');
if (r <
relatedTitles.length - 1) {
r++;
} else {
r = 0;
}
i++;
}
document.write('</ul>');
}
//]]>
</script>
<b:if cond='data:post.labels'>
<data:postLabelsLabel/>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url' rel='tag'><data:label.name/></a><b:if cond='data:label.isLast != "true"'>,</b:if>
</b:loop>
</b:if>
OR USE THIS METHOD RELATED POST HTML PART PASTE UNDED
POST QUICK INCULDABLE LINE
https://helplogger.blogspot.co.uk/2012/04/simple-related-posts-widget-for-blogger.html
POST QUICK INCULDABLE LINE
https://helplogger.blogspot.co.uk/2012/04/simple-related-posts-widget-for-blogger.html
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
STEP : 1 (REPLACE CLOSED HEADER TAG WITH BELOW CODE)
-----------------------------------------------------------------------------------------------------------<b:if cond='data:blog.pageType == "item"'>
<style type='text/css'>
#related-posts {
margin: 15px 0px;
}
#related-posts h2 {
font-size: 27px;
font-weight: normal;
color: #fff;
text-shadow: 1px 0px 2px #888;
margin-bottom: 0.75em;
}
#related-posts a {
font-size: 13px;
color: #949494;
text-transform: capitalize;
border-bottom:1px dotted #E2E2E2;
display:block;
padding:13px;
text-decoration: none;
}
#related-posts a:hover {
color: #555;
background: #F4F4F4;
}
#related-posts ul {
padding: 0px;
list-style-type: none;
background: #f9f9f9;
border-left: 5px solid #f2f2f2;
}
#related-posts li {
padding: 0px;
}
</style>
<script type='text/javascript'>
var relatedpoststitle="Related Posts";
</script>
<script type='text/javascript'>
//<![CDATA[
var relatedTitles = new Array();
var relatedTitlesNum = 0;
var relatedUrls = new Array();
function related_results_labels(json) {
for (var i = 0; i < json.feed.entry.length; i++) {
var entry = json.feed.entry[i];
relatedTitles[relatedTitlesNum] = entry.title.$t;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
relatedUrls[relatedTitlesNum] = entry.link[k].href;
relatedTitlesNum++;
break
}
}
}
}
function removeRelatedDuplicates() {
var tmp = new Array(0);
var tmp2 = new Array(0);
for (var i = 0; i < relatedUrls.length; i++) {
if (!contains(tmp, relatedUrls[i])) {
tmp.length += 1;
tmp[tmp.length - 1] = relatedUrls[i];
tmp2.length += 1;
tmp2[tmp2.length - 1] = relatedTitles[i]
}
}
relatedTitles = tmp2;
relatedUrls = tmp
}
function contains(a, e) {
for (var j = 0; j < a.length; j++) {
if (a[j] == e) {
return true
}
};
return false
}
function printRelatedLabels(currenturl) {
for (var i = 0; i < relatedUrls.length; i++) {
if (relatedUrls[i] == currenturl) {
relatedUrls.splice(i, 1);
relatedTitles.splice(i, 1)
}
}
var r = Math.floor((relatedTitles.length - 1) * Math.random());
var i = 0;
if (relatedTitles.length > 1) {
document.write('<h2>' + relatedpoststitle + '</h2>')
}
document.write('<ul>');
while (i < relatedTitles.length && i < 20 && i < maxresults) {
document.write('<li><a href="' + relatedUrls[r] + '">' + relatedTitles[r] + '</a></li>');
if (r < relatedTitles.length - 1) {
r++
} else {
r = 0
}
i++
}
document.write('</ul>');
relatedUrls.splice(0, relatedUrls.length);
relatedTitles.splice(0, relatedTitles.length);
}
//]]>
</script>
</b:if>
-----------------------------------------------------------------------------------------------------------
STEP : 2 (REPLACE <b:includable id='postQuickEdit' var='post'>
WITH BELOW CODE)
------------------------------------------------------------------------------------------------------------WITH BELOW CODE)
<b:includable id='postQuickEdit' var='post'>
<b:if cond='data:blog.pageType == "item"'><div id='related-posts'> <b:loop values='data:post.labels' var='label'> <b:if cond='data:label.isLast != "true"'> </b:if> <b:if cond='data:blog.pageType == "item"'> <script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels&max-results=6"' type='text/javascript'/></b:if></b:loop>
<script type='text/javascript'> var maxresults=5; removeRelatedDuplicates(); printRelatedLabels("<data:post.url/>"); </script><a style="font-size: 9px; color: #CECECE; float: right;" href="http://fbgadgets.blogspot.co.uk/2017/10/related-post-widget-list-without.html" rel="nofollow" >Simple Related Posts Widget</a></div></b:if>
</b:includable>
------------------------------------------------------------------------------------------------------------
OR USE THIS CODE:
------------------------------------------------------------------------------------------------------------
OR USE THIS CODE:
------------------------------------------------------------------------------------------------------------
<b:includable id='postQuickEdit' var='post'>
<b:if cond='data:blog.pageType ==
"item"'>
<div id='related-posts'>
<b:loop values='data:post.labels'
var='label'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels&max-results=6"' type='text/javascript'/>
</b:loop>
<script type='text/javascript'>
var maxresults=5;
removeRelatedDuplicates();
printRelatedLabels("<data:post.url/>");
</script>
</div>
</b:if>
</b:includable>
-----------------------------------------------------------------------------
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment