post view counter changes
This commit is contained in:
parent
41bb9fdef4
commit
346bb1877c
@ -1,4 +1,6 @@
|
|||||||
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
|
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
|
||||||
|
id: 'blog-uat'
|
||||||
|
|
||||||
url: "https://blog-uat.kottedi.in"
|
url: "https://blog-uat.kottedi.in"
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# The Site Configuration
|
# The Site Configuration
|
||||||
|
id: 'blog'
|
||||||
|
|
||||||
# Import the theme
|
# Import the theme
|
||||||
theme: jekyll-theme-chirpy
|
theme: jekyll-theme-chirpy
|
||||||
|
|||||||
92
_data/locales/en.yml
Normal file
92
_data/locales/en.yml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
# The layout text of site
|
||||||
|
|
||||||
|
# ----- Commons label -----
|
||||||
|
|
||||||
|
layout:
|
||||||
|
post: Post
|
||||||
|
category: Category
|
||||||
|
tag: Tag
|
||||||
|
|
||||||
|
# The tabs of sidebar
|
||||||
|
tabs:
|
||||||
|
# format: <filename_without_extension>: <value>
|
||||||
|
home: Home
|
||||||
|
categories: Categories
|
||||||
|
tags: Tags
|
||||||
|
archives: Archives
|
||||||
|
about: About
|
||||||
|
|
||||||
|
# the text displayed in the search bar & search results
|
||||||
|
search:
|
||||||
|
hint: search
|
||||||
|
cancel: Cancel
|
||||||
|
no_results: Oops! No results found.
|
||||||
|
|
||||||
|
panel:
|
||||||
|
lastmod: Recently Updated
|
||||||
|
trending_tags: Trending Tags
|
||||||
|
toc: Contents
|
||||||
|
|
||||||
|
copyright:
|
||||||
|
# Shown at the bottom of the post
|
||||||
|
license:
|
||||||
|
template: This post is licensed under :LICENSE_NAME by the author.
|
||||||
|
name: CC BY 4.0
|
||||||
|
link: https://creativecommons.org/licenses/by/4.0/
|
||||||
|
|
||||||
|
# Displayed in the footer
|
||||||
|
brief: Some rights reserved.
|
||||||
|
verbose: >-
|
||||||
|
Except where otherwise noted, the blog posts on this site are licensed
|
||||||
|
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
|
||||||
|
|
||||||
|
meta: Using the :PLATFORM theme :THEME
|
||||||
|
|
||||||
|
not_found:
|
||||||
|
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
|
||||||
|
|
||||||
|
notification:
|
||||||
|
update_found: A new version of content is available.
|
||||||
|
update: Update
|
||||||
|
|
||||||
|
# ----- Posts related labels -----
|
||||||
|
|
||||||
|
post:
|
||||||
|
written_by: By
|
||||||
|
posted: Posted
|
||||||
|
updated: Updated
|
||||||
|
views: Views
|
||||||
|
words: words
|
||||||
|
pageview_measure: views
|
||||||
|
read_time:
|
||||||
|
unit: min
|
||||||
|
prompt: read
|
||||||
|
relate_posts: Further Reading
|
||||||
|
share: Share
|
||||||
|
button:
|
||||||
|
next: Newer
|
||||||
|
previous: Older
|
||||||
|
copy_code:
|
||||||
|
succeed: Copied!
|
||||||
|
share_link:
|
||||||
|
title: Copy link
|
||||||
|
succeed: Link copied successfully!
|
||||||
|
|
||||||
|
# Date time format.
|
||||||
|
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||||
|
df:
|
||||||
|
post:
|
||||||
|
strftime: "%b %e, %Y"
|
||||||
|
dayjs: "ll"
|
||||||
|
archives:
|
||||||
|
strftime: "%b"
|
||||||
|
dayjs: "MMM"
|
||||||
|
|
||||||
|
# categories page
|
||||||
|
categories:
|
||||||
|
category_measure:
|
||||||
|
singular: category
|
||||||
|
plural: categories
|
||||||
|
post_measure:
|
||||||
|
singular: post
|
||||||
|
plural: posts
|
||||||
@ -10,15 +10,15 @@ platforms:
|
|||||||
icon: "fab fa-facebook-square"
|
icon: "fab fa-facebook-square"
|
||||||
link: "https://www.facebook.com/sharer/sharer.php?title=TITLE&u=URL"
|
link: "https://www.facebook.com/sharer/sharer.php?title=TITLE&u=URL"
|
||||||
|
|
||||||
- type: Telegram
|
# - type: Telegram
|
||||||
icon: "fab fa-telegram"
|
# icon: "fab fa-telegram"
|
||||||
link: "https://t.me/share/url?url=URL&text=TITLE"
|
# link: "https://t.me/share/url?url=URL&text=TITLE"
|
||||||
|
|
||||||
# Uncomment below if you need to.
|
# Uncomment below if you need to.
|
||||||
#
|
#
|
||||||
# - type: Linkedin
|
- type: Linkedin
|
||||||
# icon: "fab fa-linkedin"
|
icon: "fab fa-linkedin"
|
||||||
# link: "https://www.linkedin.com/sharing/share-offsite/?url=URL"
|
link: "https://www.linkedin.com/sharing/share-offsite/?url=URL"
|
||||||
#
|
#
|
||||||
# - type: Weibo
|
# - type: Weibo
|
||||||
# icon: "fab fa-weibo"
|
# icon: "fab fa-weibo"
|
||||||
|
|||||||
36
_includes/post-counter.html
Normal file
36
_includes/post-counter.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<em id="postvisitcounter">
|
||||||
|
</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>
|
||||||
|
function ajax(url) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.onload = function() {
|
||||||
|
resolve(this.responseText);
|
||||||
|
};
|
||||||
|
xhr.onerror = reject;
|
||||||
|
xhr.open('GET', url);
|
||||||
|
xhr.send();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteId = "{{ site.id }}";
|
||||||
|
var postId = "{{ page.title }}";
|
||||||
|
|
||||||
|
ajax("http://localhost:5016/GetCounter?siteId="+ siteId + "&postId=" + postId)
|
||||||
|
.then(function(result) {
|
||||||
|
console.log(result); // Code depending on result
|
||||||
|
document.getElementById('postvisitcounter').innerText = result;
|
||||||
|
})
|
||||||
|
.catch(function() {
|
||||||
|
// An error occurred
|
||||||
|
});
|
||||||
|
</script>
|
||||||
139
_layouts/post.html
Normal file
139
_layouts/post.html
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
refactor: true
|
||||||
|
panel_includes:
|
||||||
|
- toc
|
||||||
|
tail_includes:
|
||||||
|
- related-posts
|
||||||
|
- post-nav
|
||||||
|
- comments
|
||||||
|
---
|
||||||
|
|
||||||
|
{% include lang.html %}
|
||||||
|
|
||||||
|
<h1 data-toc-skip>{{ page.title }}</h1>
|
||||||
|
|
||||||
|
<div class="post-meta text-muted">
|
||||||
|
<!-- published date -->
|
||||||
|
<span>
|
||||||
|
{{ site.data.locales[lang].post.posted }}
|
||||||
|
{% include datetime.html date=page.date tooltip=true lang=lang %}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- lastmod date -->
|
||||||
|
{% if page.last_modified_at and page.last_modified_at != page.date %}
|
||||||
|
<span>
|
||||||
|
{{ site.data.locales[lang].post.updated }}
|
||||||
|
{% include datetime.html date=page.last_modified_at tooltip=true lang=lang %}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- post counter -->
|
||||||
|
<span>
|
||||||
|
{{ site.data.locales[lang].post.views }}
|
||||||
|
{% include post-counter.html %}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{% if page.image %}
|
||||||
|
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
|
||||||
|
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
|
||||||
|
{% capture alt %}alt="{{ page.image.alt | xml_escape | default: "Preview Image" }}"{% endcapture %}
|
||||||
|
|
||||||
|
{% capture lqip %}
|
||||||
|
{% if page.image.lqip %}
|
||||||
|
lqip="{{ page.image.lqip }}"
|
||||||
|
{% endif %}
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
<div class="mt-3 mb-3">
|
||||||
|
<img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip | strip }}>
|
||||||
|
{%- if page.image.alt -%}
|
||||||
|
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<!-- author(s) -->
|
||||||
|
<span>
|
||||||
|
{% if page.author %}
|
||||||
|
{% assign authors = page.author %}
|
||||||
|
{% elsif page.authors %}
|
||||||
|
{% assign authors = page.authors %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ site.data.locales[lang].post.written_by }}
|
||||||
|
|
||||||
|
<em>
|
||||||
|
{% if authors %}
|
||||||
|
{% for author in authors %}
|
||||||
|
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
|
||||||
|
{% unless forloop.last %}</em>, <em>{% endunless %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</em>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<!-- read time -->
|
||||||
|
{% include read-time.html content=content prompt=true lang=lang %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- .d-flex -->
|
||||||
|
|
||||||
|
</div> <!-- .post-meta -->
|
||||||
|
|
||||||
|
<div class="post-content">
|
||||||
|
{{ content }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="post-tail-wrapper text-muted">
|
||||||
|
|
||||||
|
<!-- categories -->
|
||||||
|
{% if page.categories.size > 0 %}
|
||||||
|
<div class="post-meta mb-3">
|
||||||
|
<i class="far fa-folder-open fa-fw me-1"></i>
|
||||||
|
{% for category in page.categories %}
|
||||||
|
<a href='{{ site.baseurl }}/categories/{{ category | slugify | url_encode }}/'>{{ category }}</a>
|
||||||
|
{%- unless forloop.last -%}, {%- endunless -%}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- tags -->
|
||||||
|
{% if page.tags.size > 0 %}
|
||||||
|
<div class="post-tags">
|
||||||
|
<i class="fa fa-tags fa-fw me-1"></i>
|
||||||
|
{% for tag in page.tags %}
|
||||||
|
<a href="{{ site.baseurl }}/tags/{{ tag | slugify | url_encode }}/"
|
||||||
|
class="post-tag no-text-decoration" >
|
||||||
|
{{- tag -}}
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="post-tail-bottom
|
||||||
|
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
|
||||||
|
<div class="license-wrapper">
|
||||||
|
|
||||||
|
{% if site.data.locales[lang].copyright.license.template %}
|
||||||
|
|
||||||
|
{% capture _replacement %}
|
||||||
|
<a href="{{ site.data.locales[lang].copyright.license.link }}">
|
||||||
|
{{ site.data.locales[lang].copyright.license.name }}
|
||||||
|
</a>
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include post-sharing.html lang=lang %}
|
||||||
|
|
||||||
|
</div><!-- .post-tail-bottom -->
|
||||||
|
|
||||||
|
</div><!-- div.post-tail-wrapper -->
|
||||||
Loading…
Reference in New Issue
Block a user