Skip to content

Commit 73e6ea7

Browse files
authoredJul 24, 2020
Merge pull request #20 from rohitjain00/v-0.1.5
V 0.1.5 updated
2 parents 0c1898c + 1e603b7 commit 73e6ea7

11 files changed

+324
-98
lines changed
 

‎README.md

+40-20
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ This is a minimal jekyll theme for writing blogs and about yourself.
2525
## features
2626
1. Google Analytics
2727
2. Dark mode
28+
3. Disqus comments
29+
4. Categorization
30+
5. Highly optimized blog
31+
#### PageSpeed Insights
32+
* [Home](https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Ftherohitjain.com)[(therohitjain.com)](https://therohitjain.com)
33+
* [Blog](https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Ftherohitjain.com/blog/)[(therohitjain.com/blog/)](https://therohitjain.com/blog/)
34+
* [About](https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Ftherohitjain.com/about/)[(therohitjain.com/about/)](https://therohitjain.com/about/)
35+
2836

2937
## Desktop Preview
3038

@@ -67,6 +75,8 @@ To start using the theme you need to follow these steps.
6775
6876
Assuming that you started your first website based on `minima` theme from [here](https://jekyllrb.com/docs/)
6977

78+
Add a `favicon.ico` to the root directory for favicon.
79+
7080
1. Create `blog.md` in the root folder ans set its yaml parameters to
7181

7282
```yaml
@@ -88,42 +98,52 @@ permalink: /about/
8898
home_text : [Your Text]
8999
```
90100

91-
4. In the `_congif.yml` file add a key `resume_url` and set it to the path of the Resume. Also add `author_name` to your name to appear on the website.
92-
93-
Path is relative to the root directory
101+
4. Create a new `categories.md` file in root with following yaml parameters
94102
```yaml
95-
resume_url: [PATH_TO_RESUME]
96-
author_name: [YOUR_NAME]
103+
layout: categories
97104
```
98105

106+
4. In the `_congif.yml` file add following and change accordingly
99107

100-
5. In the `index.md` file add
101-
108+
Path is relative to the root directory
102109
```yaml
103-
home_text : [some-text]
110+
resume_url: [PATH_TO_RESUME]
111+
author_name: [YOUR_NAME]
112+
description: [SITE_DESCRIPTION]
113+
url: [WEBSITE_URL]
114+
google_analytics: '[google analytics Id]'
115+
disqus:
116+
shortname: [discus-shotname]
104117
```
105118

106-
Replace "some-text" with your text
107-
108-
6. Using Google Analytics add
119+
### Minifier
109120

110-
```yaml
111-
google_analytics: [google analytics Id]
112-
```
121+
Visit [Jekyll-minifier](https://github.com/digitalsparky/jekyll-minifier) and add this to your `_config.yml` file to enable minifier.
113122

123+
### Pagination
114124

115-
### Minifier
125+
Visit [jekyll-paginate-v2](https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-GENERATOR.md#site-configuration) and add this to your `_config.yml` file to enable pagination.
116126

117-
Visit [Jekyll-minifier](https://github.com/digitalsparky/jekyll-minifier) and add this to your `_config.yml` file to enable minifier.
127+
### Check [_config.yml](https://github.com/rohitjain00/dev-portfolio-blog/blob/master/_config.yml) for example config file.
118128

119-
##### Check [_config.yml](https://github.com/rohitjain00/dev-portfolio-blog/blob/master/_config.yml) for example config file.
120129

130+
## Writing a new blog
121131

122-
### Pagination
132+
Create a new folder `_posts` in root folder
123133

124-
Visit [jekyll-paginate-v2](https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-GENERATOR.md#site-configuration) and add this to your `_config.yml` file to enable pagination.
134+
1. Create a new markdown file in the format `yyyy-mm-dd-postname.md`
135+
2. Make sure that disqus's shortname is valid.
136+
3. Add yaml configuartion to the post
125137

126-
Check [_config.yml](https://github.com/rohitjain00/dev-portfolio-blog/blob/master/_config.yml).
138+
```yaml
139+
---
140+
layout: post
141+
comments: [true | false]
142+
title: Hello World
143+
categories: [category1, category2]
144+
---
145+
Post Text.
146+
```
127147

128148

129149
## Contributing

‎_config.yml

+55-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resume_url: 'Resume.pdf'
22
author_name: 'John Doe'
3-
3+
url: johndoe.com
44
############################################################
55
# Site configuration for the Jekyll 3 Pagination Gem
66
# The values here represent the defaults if nothing is set
@@ -90,4 +90,57 @@ jekyll-minifier:
9090

9191
############################################################
9292

93-
google_analytics: UA_123456789_1
93+
# _config.yml
94+
assets:
95+
source_maps: true
96+
destination: "/assets"
97+
compression: false
98+
gzip: false
99+
defaults:
100+
integrity:
101+
{css,img,js}: false
102+
caching:
103+
enabled: true
104+
path: ".jekyll-cache/assets"
105+
type: file
106+
# --
107+
# Assets you wish to always have compiled.
108+
# This can also be combined with raw_precompile which
109+
# copies assets without running through the pipeline
110+
# making them ultra fast.
111+
# --
112+
precompile: []
113+
raw_precompile: [
114+
#
115+
]
116+
# --
117+
# baseurl: whether or not to append site.baseurl
118+
# destination: the folder you store them in on the CDN.
119+
# url: the CDN url (fqdn, or w/ identifier).
120+
# --
121+
cdn:
122+
baseurl: false
123+
destination: false
124+
url: null
125+
# --
126+
# See lib/jekyll/assets/config.rb
127+
# for a list of defaults
128+
# --
129+
sources:
130+
- _assets/custom
131+
plugins:
132+
css: { autoprefixer: {}}
133+
img: { optim: {}}
134+
135+
autoprefixer:
136+
browsers:
137+
- "last 2 versions"
138+
- "IE > 9"
139+
140+
google_analytics: 'UA_123456789_1'
141+
142+
# Disqus Comments
143+
disqus:
144+
# Leave shortname blank to disable comments site-wide.
145+
# Disable comments for any post by adding `comments: false` to that post's YAML Front Matter.
146+
shortname: my_disqus_shortname

‎_includes/disqus_comments.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<div id="disqus_thread"></div>
2+
<script>
3+
var disqus_config = function () {
4+
this.page.url = '{{ page.url | absolute_url }}';
5+
this.page.identifier = '{{ page.url | absolute_url }}';
6+
};
7+
(function() {
8+
var d = document, s = d.createElement('script');
9+
s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
10+
s.setAttribute('data-timestamp', +new Date());
11+
(d.head || d.body).appendChild(s);
12+
})();
13+
</script>
14+
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

‎_includes/themeSelector.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<select id='themeSelector' onchange="toggleTheme()">
2-
</select>
1+
<select id='themeSelector' onchange="toggleTheme()" aria-label="Select theme">
2+
</select>

‎_layouts/blog.html

+23-10
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,30 @@
44
pagetype: blog
55
---
66
<!-- This loops through the paginated posts -->
7-
<ul>
8-
{% if paginator.total_posts == 0 %}
9-
<p>No posts right now.</p>
10-
{% else %}
11-
{% for post in paginator.posts %}
12-
<h2><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h2>
13-
<small>{{ post.date | date_to_string }}</small>
14-
<p>{{ post.excerpt }}</p>
15-
{% endfor %}
16-
{% endif %}
7+
8+
9+
{% if paginator.total_posts == 0 %}
10+
<p>No posts right now.</p>
11+
{% else %}
12+
<div class="blogPage-categoryList">
13+
<ul>
14+
<li><a href="{{ "/categories/" | relative_url }}">Categories</a> : </li>
15+
{% for category in site.categories %}
16+
{% capture category_name %}{{ category | first }}{% endcapture %}
17+
<li><a href="{{"/categories/#" | append: category_name | relative_url}}">{{category_name}}</a></li>
18+
{% endfor %}
1719
</ul>
20+
</div>
21+
<ul class="blog-list">
22+
{% for post in paginator.posts %}
23+
<li>
24+
<a class="blog-heading" href="{{ post.url | relative_url }}">{{ post.title }}</a><span class="date">{{ post.date | date_to_string }}</span>
25+
<div class="excerpt">{{ post.excerpt }}</div>
26+
</li>
27+
{% endfor %}
28+
</ul>
29+
{% endif %}
30+
1831
<hr>
1932
{% if paginator.total_pages > 1 %}
2033
<ul>

‎_layouts/categories.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
layout: description
3+
permalink: /categories/
4+
title: Categories
5+
---
6+
7+
8+
<div id="archives">
9+
{% for category in site.categories %}
10+
<div class="archive-group">
11+
{% capture category_name %}{{ category | first }}{% endcapture %}
12+
<div id="#{{ category_name | slugize }}"></div>
13+
<h3 class="category-head">{{ category_name }}</h3>
14+
<a name="{{ category_name | slugize }}"></a>
15+
{% for post in site.categories[category_name] %}
16+
<article class="archive-item">
17+
&nbsp;&nbsp;<a href="{{ post.url | relative_url }}">{{post.title}} - {{ post.date | date_to_string }}</a>
18+
</article>
19+
<br>
20+
{% endfor %}
21+
</div>
22+
{% endfor %}
23+
</div>

‎_layouts/default.html

+35-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
11
<!doctype html>
2-
<html>
2+
<html lang="en">
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>{{ page.title }}</title>
7-
<link rel="stylesheet" href="{{"/assets/css/styles.css" | relative_url}}">
6+
<link rel="shortcut icon" href="{{"/favicon.ico" | relative_url }}" type="image/x-icon" />
7+
<link rel="dns-prefetch" href="https://{{ site.disqus.shortname }}.disqus.com">
8+
<meta
9+
itemprop="description"
10+
name="description"
11+
content="
12+
{% if page.description %}
13+
{{ page.description | truncate: 160 }}
14+
{% else %}
15+
{{ site.description | truncate: 160 }}
16+
{% endif %}"
17+
/>
18+
<title>
19+
{%if page.title %}
20+
{{ page.title }}
21+
{% else %}
22+
{{ site.title }}
23+
{% endif %}
24+
</title>
25+
<!-- async load css file -->
26+
<link rel="stylesheet" href="{{"/assets/css/styles.css" | relative_url}}" media="none" onload="if(media!='all')media='all'">
27+
<!-- Load css when script is disabled -->
28+
<noscript><link rel="stylesheet" href="{{"/assets/css/styles.css" | relative_url}}"></noscript>
29+
30+
<!-- Dns Prefetch the google analytics -->
31+
<link rel="dns-prefetch" href="www.googletagmanager.com">
32+
<link rel="dns-prefetch" href="www.google-analytics.com">
33+
34+
35+
36+
<!-- Load the script async and wait for the page to render for script to execute -->
37+
<script defer src="{{"/assets/js/theme.js" | relative_url }}"></script>
38+
<script defer src="{{"/assets/js/script.js" | relative_url }}"></script>
39+
840
{% include analytics.html %}
941
{% feed_meta %}
1042
{% seo %}
@@ -13,7 +45,5 @@
1345
<body onload="onLoad()">
1446
{% include themeSelector.html %}
1547
{{ content }}
16-
<script src="{{"/assets/js/theme.js" | relative_url }}"></script>
17-
<script src="{{"/assets/js/script.js" | relative_url }}"></script>
1848
</body>
1949
</html>

‎_layouts/post.html

+19-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,22 @@
33
---
44
<h2>{{ page.title }}</h2>
55
<small>{{ post.date | date_to_string }}</small>
6-
{{content}}
6+
{{content}}
7+
8+
<div class="post-categories">
9+
Categories :
10+
{% if post %}
11+
{% assign categories = post.categories %}
12+
{% else %}
13+
{% assign categories = page.categories %}
14+
{% endif %}
15+
{% for category in categories %}
16+
<a href="{{site.url}}/categories/#{{category|slugize}}">{{category}}</a>
17+
{% unless forloop.last %}&nbsp;{% endunless %}
18+
{% endfor %}
19+
</div>
20+
21+
{% if site.disqus.shortname and page.comments %}
22+
<hr>
23+
{% include disqus_comments.html %}
24+
{% endif %}

‎_sass/main.scss

+105-55
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
html {
1010
--primary-background-color: white;
1111
--primary-text-color: #222;
12+
padding: 0;
13+
margin: 0;
1214
}
1315

1416
body {
1517
background-color: var(--primary-background-color);
1618
color: var(--primary-text-color);
1719
transition: background 0.1s ease-in, color 0.1s ease-in;
18-
font-size: 120%;
20+
// font-size: 120%;
1921
}
2022
.mid-section-home {
2123
text-align: center;
@@ -91,80 +93,128 @@ body {
9193
width: 60%;
9294
margin: 0 auto;
9395
margin-top: 50px;
94-
9596
@include mediaQuery(tablet-width) {
9697
width: 70%;
9798
}
9899
@include mediaQuery(phone-width) {
99100
width: 95%;
100101
}
101-
}
102-
nav {
103-
display: flex;
104-
flex-direction: row;
105-
justify-content: space-between;
106-
align-items: stretch;
107-
flex-wrap: wrap;
108-
border-bottom: 2px solid var(--primary-text-color);
109-
* {
110-
margin: 10px;
111-
}
112-
h1 {
113-
// align-self: flex-start;
114-
font-size: 40px;
115-
}
116-
ul {
117-
flex-shrink: 1;
118-
padding: 0 10px;
119-
li {
120-
padding: 0 10px;
121-
display: inline-block;
122-
a {
123-
text-decoration : none;
124-
color: var(--primary-text-color);
125-
&:hover {
126-
border-bottom: 2px solid var(--primary-text-color);
102+
nav {
103+
display: flex;
104+
flex-direction: row;
105+
justify-content: space-between;
106+
flex-wrap: wrap;
107+
border-bottom: 2px solid var(--primary-text-color);
108+
h1 {
109+
// align-self: flex-start;
110+
font-size: 40px;
111+
flex-grow: 2;
112+
text-align: left;
113+
margin: 10px;
114+
}
115+
ul {
116+
display: flex;
117+
flex-direction: row;
118+
flex-wrap: wrap;
119+
justify-content: end;
120+
align-items: center;
121+
flex-grow: 5;
122+
li {
123+
padding: 0 20px;
124+
list-style-type: none;
125+
a {
126+
text-decoration : none;
127127
color: var(--primary-text-color);
128+
&:hover {
129+
border-bottom: 2px solid var(--primary-text-color);
130+
color: var(--primary-text-color);
131+
}
132+
}
133+
@include mediaQuery(phone-width) {
134+
text-align: center;
135+
padding: 0 10px;
128136
}
129137
}
130-
@include mediaQuery(phone-width) {
138+
}
139+
@include mediaQuery(tablet-width) {
140+
flex-direction: column;
141+
justify-content: center;
142+
align-items: center;
143+
ul {
144+
justify-content: center;
145+
}
146+
h1 {
131147
text-align: center;
132-
padding: 0 10px;
133148
}
134149
}
135150
}
136-
@include mediaQuery(phone-width) {
137-
flex-direction: column;
138-
justify-content: center;
139-
text-align: center;
140-
* {
141-
flex-basis: 100%;
151+
.sub-mid-section-cover {
152+
width: 100%;
153+
margin: 0 auto;
154+
overflow: hidden;
155+
img {
156+
max-width: 100%;
157+
}
158+
a {
159+
color: var(--primary-text-color);
142160
}
143161
}
144162
}
145-
.sub-mid-section-cover {
146-
width: 90%;
147-
margin: 0 auto;
148163

149-
* {
150-
max-width: 100%;
151-
overflow-x: scroll;
152-
}
153-
a {
154-
color: var(--primary-text-color);
155-
}
156-
}
157-
.blog-section-list {
158-
a {
159-
color: var(--primary-text-color);
160-
}
161-
}
162-
.container-404 {
163-
text-align: center;
164-
}
164+
165+
// .blog-section-list {
166+
// a {
167+
// color: var(--primary-text-color);
168+
// }
169+
// }
170+
// .container-404 {
171+
// text-align: center;
172+
// }
165173

166174
#themeSelector {
167175
position: fixed;
168176
top: 5px;
169177
right: 5px;
178+
background: var(--primary-background-color);
179+
color: var(--primary-text-color);
180+
border-radius: 5px;
181+
border: 0;
182+
}
183+
184+
.post-categories {
185+
text-align: right;
186+
}
187+
.blog-list {
188+
list-style: none;
189+
padding-left: 0;
190+
li {
191+
margin-bottom: 50px;
192+
.excerpt {
193+
font-size: 15px;
194+
}
195+
.blog-heading {
196+
font-size: 25px;
197+
font-weight: 800;
198+
}
199+
.date {
200+
font-size: 15px;
201+
opacity: 0.8;
202+
margin-left: 20px;
203+
}
204+
}
205+
206+
}
207+
.blogPage-categoryList {
208+
ul {
209+
list-style-type: none;
210+
display: flex;
211+
flex-wrap: wrap;
212+
padding-left: 0;
213+
li {
214+
margin: 10px 10px;
215+
}
216+
li:first-child {
217+
margin-left: 0;
218+
}
219+
}
170220
}

‎assets/js/script.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
function onLoad() {
22
var themeSelector = document.getElementById('themeSelector');
3-
console.log('inside on load method');
43
for (var themeName in themeMap) {
5-
console.log('inside loop' + ' ' + themeName);
64
var opt = document.createElement('option');
75
opt.value = themeName;
86
opt.innerHTML = capitalizeFirstLetter(themeName);
97
themeSelector.appendChild(opt);
108
}
9+
if (localStorage.getItem('theme') != null) {
10+
themeSelector.value = localStorage.getItem('theme');
11+
toggleTheme();
12+
}
1113
}
1214

1315
function toggleTheme() {
1416
var themeName = themeSelector.value;
17+
localStorage.setItem('theme', themeName);
1518
var element = document.getElementsByTagName('html')[0];
1619
changeTheme(element, themeMap[themeName]);
1720
}

‎dev-portfolio-blog.gemspec

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gem::Specification.new do |spec|
44
spec.name = "dev-portfolio-blog"
5-
spec.version = "0.1.4"
5+
spec.version = "0.1.5"
66
spec.authors = ["Rohit Jain"]
77
spec.email = ["rohitjain18005@gmail.com"]
88

@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
2020
spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4.0"
2121
spec.add_runtime_dependency "jekyll-paginate-v2", "~> 1.9.4"
2222
spec.add_runtime_dependency "jekyll-minifier", "~> 0.1.10"
23+
spec.add_runtime_dependency "jekyll-assets", "~> 3.0.12"
24+
spec.add_runtime_dependency "autoprefixer-rails", "~> 9.7.5"
2325
spec.add_development_dependency "bundler", "~> 2.1.4"
2426
spec.add_development_dependency "rake", "~> 12.0"
2527
end

0 commit comments

Comments
 (0)
Please sign in to comment.