Skip to content

Commit 5ed13d6

Browse files
committedNov 6, 2015
Relative links
1 parent 74897c8 commit 5ed13d6

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed
 

‎_includes/base.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- _includes/base.html -->
2+
{% assign base = '' %}
3+
{% assign depth = page.url | split: '/' | size | minus: 1 %}
4+
{% if depth == 1 %}{% assign base = '.' %}
5+
{% elsif depth == 2 %}{% assign base = '..' %}
6+
{% elsif depth == 3 %}{% assign base = '../..' %}
7+
{% elsif depth == 4 %}{% assign base = '../../..' %}{% endif %}

‎_layouts/default.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% include base.html %}
12
<!doctype html>
23
<html lang="en">
34
<head>
@@ -13,13 +14,13 @@
1314
<meta name="msapplication-tooltip" content="Anurag Khandelwal academic webpage">
1415

1516
<link href="http://fonts.googleapis.com/css?family=Montserrat:700,400" rel="stylesheet" type="text/css">
16-
<link rel="stylesheet" href="/css/styles.css">
17+
<link rel="stylesheet" href="{{ base }}/css/styles.css">
1718
<!--[if lt IE 9]>
1819
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
1920
<![endif]-->
2021

21-
<link rel="icon" href="/favicon.ico" type="image/x-icon">
22-
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
22+
<link rel="icon" href="{{ base }}/favicon.ico" type="image/x-icon">
23+
<link rel="shortcut icon" href="{{ base }}/favicon.ico" type="image/x-icon">
2324

2425
{%include google-analytics.html %}
2526
</head>
@@ -46,10 +47,10 @@ <h1>
4647
</ul>
4748
!-->
4849
</h1>
49-
<div class="img-frame"><img src="/images/me.jpg" width="180" height="180"/></div>
50+
<div class="img-frame"><img src="{{ base }}/images/me.jpg" width="180" height="180"/></div>
5051
{% comment %} External Links {% endcomment %}
5152
<ul>
52-
<li><a href="/cv/CV.pdf" target="_blank">Resume</a></li>
53+
<li><a href="{{ base }}/cv/CV.pdf" target="_blank">Resume</a></li>
5354
<li><a href="https://github.com/anuragkh" target="_blank">GitHub</a></li>
5455
<li><a href="http://www.linkedin.com/in/anuragkh" target="_blank">LinkedIn</a></li>
5556
</ul>

0 commit comments

Comments
 (0)
Please sign in to comment.