added views icon and some alignment changes and code refactoring
This commit is contained in:
parent
8d08147c91
commit
fd8c860d35
@ -1,15 +1,10 @@
|
|||||||
<em id="postvisitcounter">
|
<i class="fa fa-eye fa-fw me-1" {% if include.tooltip %} title="{{site.data.locales[include.lang].post.views}}"
|
||||||
|
data-bs-toggle="tooltip" data-bs-placement="bottom" {% endif %}></i>
|
||||||
|
<em id="visit-count">
|
||||||
</em>
|
</em>
|
||||||
|
|
||||||
<!-- <script defer>
|
|
||||||
function postvisits(response) {
|
|
||||||
document.getElementById('postvisitcounter').innerText = response.value;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script async src="http://localhost:5016/GetCounter/test?callback=postvisits"></script> -->
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
document.getElementById("postvisitcounter").style.visibility = "hidden";
|
||||||
function ajax(url) {
|
function ajax(url) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
@ -28,7 +23,8 @@ var postId = "{{ page.title }}";
|
|||||||
ajax("{{site.custom-config.blog-services.service_url}}/GetPostViews?siteId=" + siteId + "&postId=" + postId)
|
ajax("{{site.custom-config.blog-services.service_url}}/GetPostViews?siteId=" + siteId + "&postId=" + postId)
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
console.log(result); // Code depending on result
|
console.log(result); // Code depending on result
|
||||||
document.getElementById('postvisitcounter').innerText = result;
|
document.getElementById('visit-count').innerText = result;
|
||||||
|
document.getElementById("postvisitcounter").style.visibility = "visible";
|
||||||
})
|
})
|
||||||
.catch(function () {
|
.catch(function () {
|
||||||
// An error occurred
|
// An error occurred
|
||||||
|
|||||||
@ -14,6 +14,9 @@ tail_includes:
|
|||||||
<h1 data-toc-skip>{{ page.title }}</h1>
|
<h1 data-toc-skip>{{ page.title }}</h1>
|
||||||
|
|
||||||
<div class="post-meta text-muted">
|
<div class="post-meta text-muted">
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div>
|
||||||
<!-- published date -->
|
<!-- published date -->
|
||||||
<span>
|
<span>
|
||||||
{{ site.data.locales[lang].post.posted }}
|
{{ site.data.locales[lang].post.posted }}
|
||||||
@ -27,12 +30,14 @@ tail_includes:
|
|||||||
{% include datetime.html date=page.last_modified_at tooltip=true lang=lang %}
|
{% include datetime.html date=page.last_modified_at tooltip=true lang=lang %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- post counter -->
|
<!-- post counter -->
|
||||||
<span>
|
<div id="postvisitcounter">
|
||||||
{{ site.data.locales[lang].post.views }}
|
<!-- {{ site.data.locales[lang].post.views }} -->
|
||||||
{% include post-counter.html %}
|
{% include post-counter.html tooltip=true lang=lang %}
|
||||||
</span>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if page.image %}
|
{% if page.image %}
|
||||||
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
|
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
|
||||||
@ -107,8 +112,7 @@ tail_includes:
|
|||||||
<div class="post-tags">
|
<div class="post-tags">
|
||||||
<i class="fa fa-tags fa-fw me-1"></i>
|
<i class="fa fa-tags fa-fw me-1"></i>
|
||||||
{% for tag in page.tags %}
|
{% for tag in page.tags %}
|
||||||
<a href="{{ site.baseurl }}/tags/{{ tag | slugify | url_encode }}/"
|
<a href="{{ site.baseurl }}/tags/{{ tag | slugify | url_encode }}/" class="post-tag no-text-decoration">
|
||||||
class="post-tag no-text-decoration" >
|
|
||||||
{{- tag -}}
|
{{- tag -}}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user