Skip to content

Commit

Permalink
added syntax line numbers and post rating stars
Browse files Browse the repository at this point in the history
  • Loading branch information
wowthemesnet committed Mar 1, 2019
1 parent 94238af commit 24f6cba
Show file tree
Hide file tree
Showing 14 changed files with 209 additions and 40 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ group :jekyll_plugins do
gem 'jekyll-paginate'
gem 'jekyll-seo-tag'
gem 'jekyll-archives'
gem 'kramdown'
gem 'rouge'
end
12 changes: 4 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ GEM
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7-x64-mingw32)
eventmachine (1.2.7-x86-mingw32)
ffi (1.10.0-x64-mingw32)
ffi (1.10.0-x86-mingw32)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (0.9.5)
Expand Down Expand Up @@ -57,7 +55,7 @@ GEM
ffi (~> 1.0)
rouge (3.3.0)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
safe_yaml (1.0.5)
sass (3.7.3)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
Expand All @@ -67,18 +65,16 @@ GEM

PLATFORMS
x64-mingw32
x86-mingw32

DEPENDENCIES
jekyll-archives
jekyll-feed
jekyll-paginate
jekyll-seo-tag
jekyll-sitemap
kramdown
rouge
wdm (>= 0.1.0)

RUBY VERSION
ruby 2.6.1p33

BUNDLED WITH
1.17.2
1.16.4
8 changes: 7 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,10 @@ paginate_path: /page:num/

# Other
markdown: kramdown
highlighter: rouge

kramdown:
input: GFM
syntax_highlighter: rouge
syntax_highlighter_opts:
block:
line_numbers: true
10 changes: 9 additions & 1 deletion _includes/featuredbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@
<div class="h-100 card-group">
<div class="card">
<div class="card-body">
<h2 class="card-title"><a class="text-dark" href="{{ post.url | absolute_url }}">{{ post.title }}</a></h2>
<h2 class="card-title">
<a class="text-dark" href="{{ post.url | absolute_url }}">{{ post.title }}</a>
{% if post.rating %}
<div class="mb-2 mt-1 font-weight-normal">
{% include star_rating_postbox.html %}
</div>
{% endif %}
</h2>

<h4 class="card-text">{{ post.excerpt | strip_html | truncatewords:25 }}</h4>
</div>
<div class="card-footer b-0 bg-white mt-auto">
Expand Down
9 changes: 8 additions & 1 deletion _includes/postbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
</a>
</div>
<div class="card-body">
<h2 class="card-title"><a class="text-dark" href="{{ post.url | absolute_url }}">{{ post.title }}</a></h2>
<h2 class="card-title">
<a class="text-dark" href="{{ post.url | absolute_url }}">{{ post.title }}</a>
{% if post.rating %}
<div class="mb-2 mt-1 font-weight-normal">
{% include star_rating_postbox.html %}
</div>
{% endif %}
</h2>
<h4 class="card-text">{{ post.excerpt | strip_html | truncatewords:30 }}</h4>
</div>
<div class="card-footer bg-white">
Expand Down
19 changes: 19 additions & 0 deletions _includes/star_rating.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% if page.rating == 5 %}
<span class="star-rating text-warning"> &#9733;&#9733;&#9733;&#9733;&#9733;</span>
{% endif %}

{% if page.rating == 4 %}
<span class="star-rating text-warning"> &#9733;&#9733;&#9733;&#9733;&#9734;</span>
{% endif %}

{% if page.rating == 3 %}
<span class="star-rating text-warning"> &#9733;&#9733;&#9733;&#9734;&#9734;</span>
{% endif %}

{% if page.rating == 2 %}
<span class="star-rating text-warning"> &#9733;&#9733;&#9734;&#9734;&#9734;</span>
{% endif %}

{% if page.rating == 1 %}
<span class="star-rating text-warning"> &#9733;&#9734;&#9734;&#9734;&#9734;</span>
{% endif %}
19 changes: 19 additions & 0 deletions _includes/star_rating_postbox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% if post.rating == 5 %}
<span class="star-rating text-warning"> &#9733;&#9733;&#9733;&#9733;&#9733;</span>
{% endif %}

{% if post.rating == 4 %}
<span class="star-rating text-warning"> &#9733;&#9733;&#9733;&#9733;&#9734;</span>
{% endif %}

{% if post.rating == 3 %}
<span class="star-rating text-warning"> &#9733;&#9733;&#9733;&#9734;&#9734;</span>
{% endif %}

{% if post.rating == 2 %}
<span class="star-rating text-warning"> &#9733;&#9733;&#9734;&#9734;&#9734;</span>
{% endif %}

{% if post.rating == 1 %}
<span class="star-rating text-warning"> &#9733;&#9734;&#9734;&#9734;&#9734;</span>
{% endif %}
38 changes: 36 additions & 2 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ <h1 class="posttitle">{{ page.title }}</h1>
<div class="article-post">
{{content}}
</div>


<!-- Rating -->
{% if page.rating %}
<div class="rating mb-4">
<strong>Rating</strong>: {% include star_rating.html %}
</div>
{% endif %}

<!-- Post Date -->
<p>
<small>
Expand Down Expand Up @@ -106,4 +113,31 @@ <h1 class="posttitle">{{ page.title }}</h1>
</div>
{% endif %}
<!--End Comments
================================================== -->
================================================== -->


<!-- Review with LD-JSON, adapt it for your needs if you like, but make sure you test the generated HTML source code first:
https://search.google.com/structured-data/testing-tool/u/0/
================================================== -->
{% if page.rating %}
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Review",
"itemReviewed": {
"@type": "Thing",
"name": "{{ page.title }}"
},
"author": {
"@type": "Person",
"name": "{{ author.display_name }}"
},
"datePublished": "{{ page.date | date:"%Y-%m-%d" }}",
"reviewRating": {
"@type": "Rating",
"ratingValue": "{{ page.rating }}",
"bestRating": "5"
}
}
</script>
{% endif %}
26 changes: 17 additions & 9 deletions _posts/2018-01-11-customer-service.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
---
layout: post
title: "What is Jekyll"
title: "Inception Movie"
author: john
categories: [ Jekyll, tutorial ]
image: assets/images/11.jpg
description: "My review of Inception movie. Acting, plot and something else in this short description."
featured: true
hidden: true
rating: 5
---

No more databases, comment moderation, or pesky updates to install-just your content. Markdown, Liquid, HTML & CSS go in. Static sites come out ready for deployment. Permalinks, categories, pages, posts, and custom layouts are all first-class citizens here.
Review products, books, movies, restaurant and anything you like on your Jekyll blog with Mediumish! JSON-LD ready for review property.

Sick of dealing with hosting companies? GitHub Pages are powered by Jekyll, so you can easily deploy your site using GitHub for free-custom domain name and all.
#### How to use?

## What is Jekyll?
It's actually really simple! Add the rating in your YAML front matter:

Jekyll is a simple, blog-aware, static site generator.

You create your content as text files (Markdown), and organize them into folders. Then, you build the shell of your site using Liquid-enhanced HTML templates. Jekyll automatically stitches the content and templates together, generating a website made entirely of static assets, suitable for uploading to any server.

Jekyll happens to be the engine behind GitHub Pages, so you can host your project’s Jekyll page/blog/website on GitHub’s servers for free.
```html
---
layout: post
title: "Inception Movie"
author: john
categories: [ Jekyll, tutorial ]
image: assets/images/11.jpg
description: "My review of Inception movie. Actors, directing and more."
rating: 5
---
```
1 change: 1 addition & 0 deletions _posts/2018-05-12-about-bundler.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: "About Bundler"
author: sal
categories: [ Jekyll ]
image: assets/images/2.jpg
rating: 3
---
`gem install bundler` installs the bundler gem through RubyGems. You only need to install it once - not every time you create a new Jekyll project. Here are some additional details:

Expand Down
59 changes: 58 additions & 1 deletion _posts/2018-06-12-powerful-things-markdown-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,64 @@ There are two types of code elements which can be inserted in Markdown, the firs
}
```

If you want to get really fancy, you can even add syntax highlighting using Rouge.
#### HTML

```html
<li class="ml-1 mr-1">
<a target="_blank" href="#">
<i class="fab fa-twitter"></i>
</a>
</li>
```

#### CSS

```css
.highlight .c {
color: #999988;
font-style: italic;
}
.highlight .err {
color: #a61717;
background-color: #e3d2d2;
}
```

#### JS

```js
// alertbar later
$(document).scroll(function () {
var y = $(this).scrollTop();
if (y > 280) {
$('.alertbar').fadeIn();
} else {
$('.alertbar').fadeOut();
}
});
```

#### Python

```python
print("Hello World")
```

#### Ruby

```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```

#### C

```c
printf("Hello World");
```
![walking]({{ site.baseurl }}/assets/images/8.jpg)
Expand Down
4 changes: 3 additions & 1 deletion _sass/_syntax.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

.highlight {
background: #ffffff;
background: #F7FAFB;
.c { color: #999988; font-style: italic } /* Comment */
.err { color: #a61717; background-color: #e3d2d2 } /* Error */
.k { font-weight: bold } /* Keyword */
Expand Down Expand Up @@ -62,3 +62,5 @@
.il { color: #009999 } /* Literal.Number.Integer.Long */
}

td.rouge-code { width: 100%;}
pre.lineno { color: #9999;}
32 changes: 18 additions & 14 deletions assets/css/screen.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
Template Name: Mediumish
Copyright: Sal, WowThemes.net, https://www.wowthemes.net
Version: 1.0.24
License: https://www.wowthemes.net/freebies-license/
*/
.mainheading {
Expand All @@ -16,18 +15,20 @@ License: https://www.wowthemes.net/freebies-license/
text-decoration:none;
}
pre {
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 0 0 1.75em 0;
border: #E3EDF3 1px solid;
width: 100%;
padding: 10px;
font-family: monospace, sans-serif;
font-size: 14px;
white-space: pre;
overflow: auto;
background: #F7FAFB;
border-radius: 3px;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 0 0 1.75em 0;
border: #E3EDF3 1px solid;
width: 100%;
padding: 10px;
font-family: monospace, sans-serif;
font-size: 14px;
white-space: pre;
overflow: auto;
background: #F7FAFB;
border-radius: 3px;
line-height: 1.6;
color:#333;
}
.mediumnavigation {
background:rgba(255,255,255,.97);
Expand Down Expand Up @@ -663,4 +664,7 @@ License: https://www.wowthemes.net/freebies-license/
}
.sticky-top-80 {
top:80px;
}
}
.star-rating {
font-size:20px;
}
10 changes: 8 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# Mediumish Jekyll Theme - Change Log

## 2019-03-01, v1.0.26

### Added
- Syntax line numbers

### Fixed
- Category links with more than 1 word

## 2019-02-14

### Fixed
- Feed site title not showing

### Added
- 404 page


## 2019-02-10

### Fixed
Expand Down

0 comments on commit 24f6cba

Please sign in to comment.