Merge branch 'dev' of rajukottedi/chirpy-blogging into prod

This commit is contained in:
Bangara Raju Kottedi 2023-08-19 22:16:19 +05:30 committed by Gogs
commit 27e59a86bc
10 changed files with 319 additions and 20 deletions

View File

@ -1,10 +0,0 @@
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
url: "https://blog-uat.kottedi.in"
comments:
active: 'remark42' # The global switch for posts comments, e.g., 'disqus'. Keep it empty means disable
# The active options are as follows:
# remark42 settings > https://remark42.com/
remark42:
host: 'https://remark42.kottedi.in'
site_id: 'blog-uat'

9
_config-prod.yml Normal file
View File

@ -0,0 +1,9 @@
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
id: 'blog'
url: "https://blog.kottedi.in"
# Custom configuration
custom-config:
blog-services:
service_url: 'https://blog-services.kottedi.in'

9
_config-uat.yml Normal file
View File

@ -0,0 +1,9 @@
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
id: 'blog-uat'
url: "https://blog-uat.kottedi.in"
# Custom configuration
custom-config:
blog-services:
service_url: 'https://blog-services.kottedi.in'

View File

@ -1,4 +1,5 @@
# The Site Configuration # The Site Configuration
id: 'blog-dev'
# Import the theme # Import the theme
theme: jekyll-theme-chirpy theme: jekyll-theme-chirpy
@ -26,7 +27,7 @@ description: >- # used by seo meta and the atom feed
Sharing knowledge through blogging using jekyll theme chirpy template. Sharing knowledge through blogging using jekyll theme chirpy template.
# 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'
url: "https://blog.kottedi.in" url: "http://localhost:4000"
github: github:
username: rajukottedi # change to your github username username: rajukottedi # change to your github username
@ -87,7 +88,6 @@ comments:
# remark42 settings > https://remark42.com/ # remark42 settings > https://remark42.com/
remark42: remark42:
host: 'https://remark42.kottedi.in' host: 'https://remark42.kottedi.in'
site_id: 'blog'
disqus: disqus:
shortname: # fill with the Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname shortname: # fill with the Disqus shortname. https://help.disqus.com/en/articles/1717111-what-s-a-shortname
# utterances settings https://utteranc.es/ # utterances settings https://utteranc.es/
@ -199,4 +199,10 @@ jekyll-archives:
category: /categories/:name/ category: /categories/:name/
show_drafts: false show_drafts: false
future: false future: false
# Custom configuration
custom-config:
blog-services:
service_url: 'http://localhost:5000'

92
_data/locales/en.yml Normal file
View 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

View File

@ -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"

View File

@ -1,7 +1,7 @@
<script> <script>
var remark_config = { var remark_config = {
host: "{{ site.comments.remark42.host }}", host: "{{ site.comments.remark42.host }}",
site_id: '{{ site.comments.remark42.site_id }}', site_id: '{{ site.id }}',
components: ['embed'], components: ['embed'],
max_shown_comments: 10, max_shown_comments: 10,

View 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("{{site.custom-config.blog-services.service_url}}/GetPostViews?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
View 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 -->

18
db_scripts/mysql.sql Normal file
View File

@ -0,0 +1,18 @@
-- Create USER
-- CREATE USER 'user1'@localhost IDENTIFIED BY 'password1';
CREATE USER blog_admin@'%' IDENTIFIED BY 'pass@1234';
GRANT ALL PRIVILEGES ON blogDB.* TO blog_admin@'%';
SHOW GRANTS FOR blog_admin@'%';
FLUSH PRIVILEGES
-- Create Counter Table
-- DROP TABLE PostVisitCounter
-- create table PostVisitCounter (id INT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, siteid nvarchar(500), postid nvarchar(500), count INT(20), datecreated TIMESTAMP, datemodified TIMESTAMP);