Skip to content

Commit

Permalink
Merge pull request #20 from rohitjain00/v-0.1.5
Browse files Browse the repository at this point in the history
V 0.1.5 updated
  • Loading branch information
rohitjain00 authored Jul 24, 2020
2 parents 0c1898c + 1e603b7 commit 73e6ea7
Show file tree
Hide file tree
Showing 11 changed files with 324 additions and 98 deletions.
60 changes: 40 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ This is a minimal jekyll theme for writing blogs and about yourself.
## features
1. Google Analytics
2. Dark mode
3. Disqus comments
4. Categorization
5. Highly optimized blog
#### PageSpeed Insights
* [Home](https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Ftherohitjain.com)[(therohitjain.com)](https://therohitjain.com)
* [Blog](https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Ftherohitjain.com/blog/)[(therohitjain.com/blog/)](https://therohitjain.com/blog/)
* [About](https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Ftherohitjain.com/about/)[(therohitjain.com/about/)](https://therohitjain.com/about/)


## Desktop Preview

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

Add a `favicon.ico` to the root directory for favicon.

1. Create `blog.md` in the root folder ans set its yaml parameters to

```yaml
Expand All @@ -88,42 +98,52 @@ permalink: /about/
home_text : [Your Text]
```

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.

Path is relative to the root directory
4. Create a new `categories.md` file in root with following yaml parameters
```yaml
resume_url: [PATH_TO_RESUME]
author_name: [YOUR_NAME]
layout: categories
```

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

5. In the `index.md` file add

Path is relative to the root directory
```yaml
home_text : [some-text]
resume_url: [PATH_TO_RESUME]
author_name: [YOUR_NAME]
description: [SITE_DESCRIPTION]
url: [WEBSITE_URL]
google_analytics: '[google analytics Id]'
disqus:
shortname: [discus-shotname]
```

Replace "some-text" with your text

6. Using Google Analytics add
### Minifier

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

### Pagination

### Minifier
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.

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

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

## Writing a new blog

### Pagination
Create a new folder `_posts` in root folder

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.
1. Create a new markdown file in the format `yyyy-mm-dd-postname.md`
2. Make sure that disqus's shortname is valid.
3. Add yaml configuartion to the post

Check [_config.yml](https://github.com/rohitjain00/dev-portfolio-blog/blob/master/_config.yml).
```yaml
---
layout: post
comments: [true | false]
title: Hello World
categories: [category1, category2]
---
Post Text.
```


## Contributing
Expand Down
57 changes: 55 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resume_url: 'Resume.pdf'
author_name: 'John Doe'

url: johndoe.com
############################################################
# Site configuration for the Jekyll 3 Pagination Gem
# The values here represent the defaults if nothing is set
Expand Down Expand Up @@ -90,4 +90,57 @@ jekyll-minifier:

############################################################

google_analytics: UA_123456789_1
# _config.yml
assets:
source_maps: true
destination: "/assets"
compression: false
gzip: false
defaults:
integrity:
{css,img,js}: false
caching:
enabled: true
path: ".jekyll-cache/assets"
type: file
# --
# Assets you wish to always have compiled.
# This can also be combined with raw_precompile which
# copies assets without running through the pipeline
# making them ultra fast.
# --
precompile: []
raw_precompile: [
#
]
# --
# baseurl: whether or not to append site.baseurl
# destination: the folder you store them in on the CDN.
# url: the CDN url (fqdn, or w/ identifier).
# --
cdn:
baseurl: false
destination: false
url: null
# --
# See lib/jekyll/assets/config.rb
# for a list of defaults
# --
sources:
- _assets/custom
plugins:
css: { autoprefixer: {}}
img: { optim: {}}

autoprefixer:
browsers:
- "last 2 versions"
- "IE > 9"

google_analytics: 'UA_123456789_1'

# Disqus Comments
disqus:
# Leave shortname blank to disable comments site-wide.
# Disable comments for any post by adding `comments: false` to that post's YAML Front Matter.
shortname: my_disqus_shortname
14 changes: 14 additions & 0 deletions _includes/disqus_comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url | absolute_url }}';
};
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
4 changes: 2 additions & 2 deletions _includes/themeSelector.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<select id='themeSelector' onchange="toggleTheme()">
</select>
<select id='themeSelector' onchange="toggleTheme()" aria-label="Select theme">
</select>
33 changes: 23 additions & 10 deletions _layouts/blog.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,30 @@
pagetype: blog
---
<!-- This loops through the paginated posts -->
<ul>
{% if paginator.total_posts == 0 %}
<p>No posts right now.</p>
{% else %}
{% for post in paginator.posts %}
<h2><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h2>
<small>{{ post.date | date_to_string }}</small>
<p>{{ post.excerpt }}</p>
{% endfor %}
{% endif %}


{% if paginator.total_posts == 0 %}
<p>No posts right now.</p>
{% else %}
<div class="blogPage-categoryList">
<ul>
<li><a href="{{ "/categories/" | relative_url }}">Categories</a> : </li>
{% for category in site.categories %}
{% capture category_name %}{{ category | first }}{% endcapture %}
<li><a href="{{"/categories/#" | append: category_name | relative_url}}">{{category_name}}</a></li>
{% endfor %}
</ul>
</div>
<ul class="blog-list">
{% for post in paginator.posts %}
<li>
<a class="blog-heading" href="{{ post.url | relative_url }}">{{ post.title }}</a><span class="date">{{ post.date | date_to_string }}</span>
<div class="excerpt">{{ post.excerpt }}</div>
</li>
{% endfor %}
</ul>
{% endif %}

<hr>
{% if paginator.total_pages > 1 %}
<ul>
Expand Down
23 changes: 23 additions & 0 deletions _layouts/categories.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
layout: description
permalink: /categories/
title: Categories
---


<div id="archives">
{% for category in site.categories %}
<div class="archive-group">
{% capture category_name %}{{ category | first }}{% endcapture %}
<div id="#{{ category_name | slugize }}"></div>
<h3 class="category-head">{{ category_name }}</h3>
<a name="{{ category_name | slugize }}"></a>
{% for post in site.categories[category_name] %}
<article class="archive-item">
&nbsp;&nbsp;<a href="{{ post.url | relative_url }}">{{post.title}} - {{ post.date | date_to_string }}</a>
</article>
<br>
{% endfor %}
</div>
{% endfor %}
</div>
40 changes: 35 additions & 5 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,42 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ page.title }}</title>
<link rel="stylesheet" href="{{"/assets/css/styles.css" | relative_url}}">
<link rel="shortcut icon" href="{{"/favicon.ico" | relative_url }}" type="image/x-icon" />
<link rel="dns-prefetch" href="https://{{ site.disqus.shortname }}.disqus.com">
<meta
itemprop="description"
name="description"
content="
{% if page.description %}
{{ page.description | truncate: 160 }}
{% else %}
{{ site.description | truncate: 160 }}
{% endif %}"
/>
<title>
{%if page.title %}
{{ page.title }}
{% else %}
{{ site.title }}
{% endif %}
</title>
<!-- async load css file -->
<link rel="stylesheet" href="{{"/assets/css/styles.css" | relative_url}}" media="none" onload="if(media!='all')media='all'">
<!-- Load css when script is disabled -->
<noscript><link rel="stylesheet" href="{{"/assets/css/styles.css" | relative_url}}"></noscript>

<!-- Dns Prefetch the google analytics -->
<link rel="dns-prefetch" href="www.googletagmanager.com">
<link rel="dns-prefetch" href="www.google-analytics.com">



<!-- Load the script async and wait for the page to render for script to execute -->
<script defer src="{{"/assets/js/theme.js" | relative_url }}"></script>
<script defer src="{{"/assets/js/script.js" | relative_url }}"></script>

{% include analytics.html %}
{% feed_meta %}
{% seo %}
Expand All @@ -13,7 +45,5 @@
<body onload="onLoad()">
{% include themeSelector.html %}
{{ content }}
<script src="{{"/assets/js/theme.js" | relative_url }}"></script>
<script src="{{"/assets/js/script.js" | relative_url }}"></script>
</body>
</html>
20 changes: 19 additions & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,22 @@
---
<h2>{{ page.title }}</h2>
<small>{{ post.date | date_to_string }}</small>
{{content}}
{{content}}

<div class="post-categories">
Categories :
{% if post %}
{% assign categories = post.categories %}
{% else %}
{% assign categories = page.categories %}
{% endif %}
{% for category in categories %}
<a href="{{site.url}}/categories/#{{category|slugize}}">{{category}}</a>
{% unless forloop.last %}&nbsp;{% endunless %}
{% endfor %}
</div>

{% if site.disqus.shortname and page.comments %}
<hr>
{% include disqus_comments.html %}
{% endif %}
Loading

0 comments on commit 73e6ea7

Please sign in to comment.