Skip to content

Commit a3cc071

Browse files
author
Nico Prananta
committed
support baseurl. issue #4
1 parent 44bafb9 commit a3cc071

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

_includes/head.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<link rel="stylesheet" href="{{ "/css/component.css" | prepend: site.baseurl }}">
1111
<link rel="stylesheet" href="{{ "/css/demo.css" | prepend: site.baseurl }}">
1212
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
13-
<link rel="shortcut icon" href="{% if page.favicon %}{{ page.favicon }}{% else %}{{ "favicon.ico" }}{% endif %}">
13+
<link rel="shortcut icon" href="{% if page.favicon %}{{ page.favicon | prepend: site.baseurl }}{% else %}{{ "favicon.ico" }}{% endif %}">
1414
<link rel="stylesheet" type="text/css" href="{{ "/fonts/feather/style.css" | prepend: site.baseurl }}">
1515
<link rel="stylesheet" type="text/css" href="{{ "/css/animate.min.css" | prepend: site.baseurl }}">
16-
<script src="/js/modernizr.custom.js"></script>
17-
<script src="/js/hammer.min.js"></script>
16+
<script src="{{ "/js/modernizr.custom.js" | prepend: site.baseurl }}"></script>
17+
<script src="{{ "/js/hammer.min.js" | prepend: site.baseurl }}"></script>
1818
{% if site.facebook %}
1919
<meta property="og:site_name" content="{% if page.facebook.site_name %}{{ page.facebook.site_name }}{% else %}{{ site.title }}{% endif %}"/>
2020
<meta property="og:title" content="{% if page.facebook.site_name %}{{ page.facebook.title }}{% elsif page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}"/>

_layouts/default.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
</div>
2727
<div class="avatar">
28-
<img alt="" src="{{ site.author.avatar | prepend: base.url }}">
28+
<img alt="" src="{{ site.author.avatar | prepend: site.baseurl }}">
2929
</div>
3030
<div class="info">
3131
<div class="title">

_plugins/download.rb

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def initialize(tag_name, text, tokens)
1818
end
1919

2020
def render(context)
21+
site = context.registers[:site]
22+
@img = site.baseurl + @img
2123
if @url.length > 0
2224
if @text
2325
rendered = "<p style=\"text-align: center\"><a href=\""+@url+"\" class=\"centerbutton\">"+@text+"</a></p>"

_plugins/image.rb

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def initialize(tag_name, text, tokens)
1212
end
1313

1414
def render(context)
15+
site = context.registers[:site]
16+
@src = site.baseurl + @src
1517
if @alignment.downcase == "fill-width"
1618
# See below for explanation of [[[[ ]]]]
1719
"[[[[ <img class=\""+@alignmentClass+"\" src=\""+@src+"\" alt=\""+@alt+"\" /> ]]]]"

index.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
<div style="display: flex; flex-direction: column; height: 88%; width: 100%; position: absolute; justify-content: center;">
66
<section class="slider" id="main_slider">
77
{% for post in site.posts %}
8-
<div class="slide" data-content="{% if post.external_url %}{{ post.external_url }}{% else %}{{ post.permalink }}{% endif %}">
8+
<div class="slide" data-content="{% if post.external_url %}{{ post.external_url }}{% else %}{{ post.permalink | prepend: site.baseurl }}{% endif %}">
99
<div class="slide__mover">
1010
<div class="zoomer flex-center">
11-
<img class="zoomer__image" src="/images/{{ post.device }}.png" alt="{{ post.device }}" />
11+
{% assign device_image = '/images/' | append: post.device | append: '.png' | prepend: site.baseurl %}
12+
<img class="zoomer__image" src="{{ device_image }}" alt="{{ post.device }}" />
1213
<div class="preview">
1314
{% assign app_preview = '/images/' | append: post.name | downcase | append: '/preview.png' %}
1415
{% if post.app_preview %}
1516
{% assign app_preview = post.app_preview %}
1617
{% endif %}
17-
<img src="{{ app_preview }}" alt="{{ post.name }}" />
18+
<img src="{{ app_preview | prepend: site.baseurl }}" alt="{{ post.name }}" />
1819
<div class="zoomer__area zoomer__area--size-5"></div>
1920
</div>
2021
</div>

js/main.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
---
3+
14
/**
25
* main.js
36
* http://www.codrops.com
@@ -329,7 +332,7 @@
329332

330333
isOpen = false;
331334

332-
window.location = '/'+item.getAttribute('data-content')+'?fr='+current;
335+
window.location = item.getAttribute('data-content')+'?fr='+current;
333336

334337
return;
335338
});
@@ -368,7 +371,7 @@
368371
if (qs["fr"] > 0) {
369372
window.history.back();
370373
} else {
371-
window.location = '/';
374+
window.location = {{ site.baseurl }};
372375
}
373376
});
374377
}
@@ -465,7 +468,7 @@
465468
if (current > 0) {
466469
window.history.replaceState(null, '', '#'+current);
467470
} else {
468-
window.history.replaceState(null, '', '/');
471+
window.history.replaceState(null, '', '#');
469472
}
470473

471474
if (current % 2 == 0) {

0 commit comments

Comments
 (0)