Skip to content

Commit d1e457a

Browse files
authored
Right-to-Left support (addresses #51) (#73)
* ♻️ move avatar source into dash namespace * ✨ introduce RTL support * add readme info * ♻️ use boolean instead
1 parent 8ba72a7 commit d1e457a

File tree

6 files changed

+112
-34
lines changed

6 files changed

+112
-34
lines changed

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,24 @@ tag_page_layout: tag_page
6161
tag_page_dir: tag
6262

6363
dash:
64+
# the way how dates should be displayed
6465
date_format: "%b %-d, %Y"
6566

67+
# (optional) discqus comment configuration
6668
disqus:
67-
shortname: <your-disqus-shortname>
69+
shortname: <your-disqus-shortname>
70+
71+
# the animation speed of the post scroll-in effect
72+
animation_speed: 50
73+
74+
# wether to enable Right-to-Left support or not
75+
rtl: false
76+
77+
# Replaces the default avatar provider (gravatar)
78+
#avatar_source: github
79+
#github_username: bitbrain
80+
#avatar_source: local
81+
#avatar_path: /assets/avatar.png
6882

6983
# generate social links in footer
7084
# supported colors: green, red, orange, blue, cyan, pink, teal, yellow, indigo, purple
@@ -78,12 +92,9 @@ dash:
7892
- url: https://github.com/bitbrain
7993
icon: github-square
8094
color: purple
81-
95+
96+
# wether the author box should be displayed or not
8297
show_author: true
83-
84-
# Replaces the default avatar provider (gravatar)
85-
#avatar_source: github
86-
#github_username: bitbrain
8798
```
8899
## Using this theme directly on Github Pages
89100

_config.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ tag_page_dir: tag
1717
# jekyll-dash date format
1818
# refer to http://shopify.github.io/liquid/filters/date/ if you want to customize this
1919
dash:
20+
# the way how dates should be displayed
2021
date_format: "%b %-d, %Y"
2122

23+
# (optional) discqus comment configuration
2224
disqus:
2325
shortname: bitbrain-github-io
2426

@@ -35,10 +37,21 @@ dash:
3537
icon: github-square
3638
color: purple
3739

40+
# wether the author box should be displayed
3841
show_author: true
3942

43+
# the animation speed of the scroll-in effect
4044
animation_speed: 50
4145

46+
# wether to enable Right-to-Left support or not
47+
rtl: false
48+
49+
# Replaces the default avatar provider (gravatar)
50+
#avatar_source: github
51+
#github_username: bitbrain
52+
#avatar_source: local
53+
#avatar_path: /assets/avatar.png
54+
4255
# Build settings
4356
theme: jekyll-dash
4457

@@ -48,9 +61,3 @@ plugins:
4861
- jekyll-paginate
4962
- liquid-md5
5063
- jekyll/tagging
51-
52-
# Replaces the default avatar provider (gravatar)
53-
#avatar_source: github
54-
#github_username: bitbrain
55-
#avatar_source: local
56-
#avatar_path: /assets/avatar.png

_includes/author.html

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
<div class="author-box">
2-
{% if site.avatar_source == "github" and site.github_username %}
3-
{% capture avatar_image %}
4-
https://github.com/{{ site.github_username }}.png
5-
{% endcapture %}
6-
{% elsif site.avatar_source == "local" and site.avatar_path %}
7-
{% capture avatar_image %}
8-
{{site.avatar_path}}
9-
{% endcapture %}
10-
{% elsif site.plugins contains "liquid-md5" %}
11-
{% capture avatar_image %}
12-
https://gravatar.com/avatar/{{ site.email | downcase | md5 }}?s=256
13-
{% endcapture %}
14-
{% endif %}
15-
{% if avatar_image %}
16-
<img src="{{ avatar_image }}" class="author-avatar" alt="Avatar" />
17-
{% endif %}
18-
{{ site.description }}
2+
{% if site.dash.rtl %}
3+
<div class="description">{{ site.description }}</div>
4+
{%- include avatar.html -%}
5+
{% else %}
6+
{%- include avatar.html -%}
7+
<div class="description">{{ site.description }}</div>
8+
{% endif %}
199
</div>

_includes/avatar.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% if site.dash.avatar_source == "github" and site.dash.github_username %}
2+
{% capture avatar_image %}
3+
https://github.com/{{ site.github_username }}.png
4+
{% endcapture %}
5+
{% elsif site.dash.avatar_source == "local" and site.dash.avatar_path %}
6+
{% capture avatar_image %}
7+
{{site.dash.avatar_path}}
8+
{% endcapture %}
9+
{% elsif site.plugins contains "liquid-md5" %}
10+
{% capture avatar_image %}
11+
https://gravatar.com/avatar/{{ site.email | downcase | md5 }}?s=256
12+
{% endcapture %}
13+
{% endif %}
14+
{% if avatar_image %}
15+
<img src="{{ avatar_image }}" class="author-avatar" alt="Avatar" />
16+
{% endif %}

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
2+
<html class="{% if site.dash.rtl %}direction--rtl{% else %}direction--ltr{% endif %}"lang="{{ page.lang | default: site.lang | default: "en" }}">
33

44
{%- include head.html -%}
55

_sass/dash/_layout.scss

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,75 @@
5252
}
5353

5454
/**
55-
* Author box
55+
* Right-to-Left support
5656
*/
5757

58+
html.direction--rtl {
59+
.author-box {
60+
text-align: right;
61+
& > .description {
62+
direction: rtl;
63+
}
64+
& > img {
65+
margin-right: 0em;
66+
margin-left: 1em;
67+
}
68+
}
69+
ol > li, ul > li {
70+
text-align: right;
71+
direction: rtl;
72+
&::before {
73+
float: right;
74+
margin-left: 0.5em;
75+
}
76+
}
77+
h1, h2, h3, h4, h5, h6 {
78+
direction: rtl;
79+
text-align: right;
80+
}
81+
.post-link-wrapper {
82+
direction: rtl;
83+
}
84+
.post {
85+
direction: rtl;
86+
}
87+
.pagination {
88+
text-align: right;
89+
}
90+
.tag-cloud {
91+
direction: rtl;
92+
text-align: right;
93+
}
94+
.related-posts {
95+
direction: rtl;
96+
text-align: right;
97+
98+
& > li::before {
99+
margin-right: 0;
100+
margin-left: 0.5em;
101+
}
102+
}
103+
pre {
104+
direction: ltr;
105+
text-align: left;
106+
}
107+
}
108+
58109
.author-box {
59110
margin-bottom: 1em;
60111
text-align: left;
61112
min-height: 72px;
62113
font-style: italic;
114+
display: inline-flex;
115+
& > .description {
116+
flex:8;
117+
}
63118
& > .author-avatar {
64-
float: left;
65-
white-space: pre-line;
66119
margin-right: 1em;
67120
width: 72px;
68-
height: 72px;
121+
height: 100%;
69122
border-radius: 0.3em;
123+
flex: 1;
70124
}
71125
}
72126

0 commit comments

Comments
 (0)