Skip to content

Commit 73e6ea7

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

File tree

11 files changed

+324
-98
lines changed

11 files changed

+324
-98
lines changed

README.md

Lines changed: 40 additions & 20 deletions
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

Lines changed: 55 additions & 2 deletions
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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 23 additions & 10 deletions
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

Lines changed: 23 additions & 0 deletions
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

Lines changed: 35 additions & 5 deletions
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

Lines changed: 19 additions & 1 deletion
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 %}

0 commit comments

Comments
 (0)