Skip to content

Commit 6fda5af

Browse files
committed
Add distill post styles and template
1 parent 6e9de53 commit 6fda5af

17 files changed

+22661
-51
lines changed

_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ pagination:
5151
collection: 'posts'
5252
permalink: /page/:num/
5353
per_page: 3
54+
sort_field: 'date'
55+
sort_reverse: true
5456
trail:
5557
before: 1 # The number of links before the current page
5658
after: 3 # The number of links after the current page

_includes/head.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:100,300,400,500,700|Material+Icons">
1616

1717
<!-- Styles -->
18-
<link rel="shortcut icon" href="{{ '/assets/img/favicon.ico' | prepend: site.baseurl | prepend: site.url }}">
19-
<link rel="stylesheet" href="{{ '/assets/css/main.css' | prepend: site.baseurl | prepend: site.url }}">
18+
<link rel="shortcut icon" href="{{ '/assets/img/favicon.ico' | relative_url }}">
19+
<link rel="stylesheet" href="{{ '/assets/css/main.css' | relative_url }}">
2020

21-
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
21+
<link rel="canonical" href="{{ page.url | replace:'index.html','' | relative_url }}">

_includes/header.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<ul class="navbar-nav ml-auto flex-nowrap">
2424
<!-- About -->
2525
<li class="nav-item {% if page.title == 'about' %}active{% endif %}">
26-
<a class="nav-link" href="{{ '/' | prepend: site.baseurl | prepend: site.url }}">
26+
<a class="nav-link" href="{{ '/' | relative_url }}">
2727
about
2828
{% if page.title == "about" %}
2929
<span class="sr-only">(current)</span>
@@ -32,7 +32,7 @@
3232
</li>
3333
<!-- Blog -->
3434
<li class="nav-item {% if page.url contains 'blog' %}active{% endif %}">
35-
<a class="nav-link" href="{{ '/blog/' | prepend: site.baseurl | prepend: site.url }}">
35+
<a class="nav-link" href="{{ '/blog/' | relative_url }}">
3636
blog
3737
{% if page.title == "blog" %}
3838
<span class="sr-only">(current)</span>
@@ -43,7 +43,7 @@
4343
{% for p in site.pages %}
4444
{% if p.nav %}
4545
<li class="nav-item {% if page.title == p.title %}active{% endif %}">
46-
<a class="nav-link" href="{{ p.url | prepend: site.baseurl | prepend: site.url }}">
46+
<a class="nav-link" href="{{ p.url | relative_url }}">
4747
{{ p.title }}
4848
{% if page.title == p.title %}
4949
<span class="sr-only">(current)</span>

_includes/hemline.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<script src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/{{ site.mdb_version }}/js/mdb.min.js"></script>
66

77
<!-- Load Common JS -->
8-
<script src="{{ '/assets/js/common.js' | prepend: site.baseurl | prepend: site.url }}"></script>
8+
<script src="{{ '/assets/js/common.js' | relative_url }}"></script>
99

1010
<!-- Code Syntax Highlighting -->
1111
<link rel="stylesheet" href="https://gitcdn.link/repo/jwarby/jekyll-pygments-themes/master/{{ site.highlight_theme }}.css" />
@@ -14,7 +14,7 @@
1414
<!-- Load KaTeX -->
1515
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/{{ site.katex_version }}/katex.min.css" integrity="sha256-V8SV2MO1FUb63Bwht5Wx9x6PVHNa02gv8BgH/uH3ung=" crossorigin="anonymous" />
1616
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/{{ site.katex_version }}/katex.min.js" integrity="sha256-F/Xda58SPdcUCr+xhSGz9MA2zQBPb0ASEYKohl8UCHc=" crossorigin="anonymous"></script>
17-
<script src="{{ '/assets/js/katex.js' | prepend: site.baseurl | prepend: site.url }}"></script>
17+
<script src="{{ '/assets/js/katex.js' | relative_url }}"></script>
1818
{% endif %}
1919

2020
{% if site.enable_mansory %}
@@ -24,7 +24,7 @@
2424

2525
{% if site.enable_progressbar %}
2626
<!-- Load Progress Bar -->
27-
<script src="{{ '/assets/js/progressbar.js' | prepend: site.baseurl | prepend: site.url }}"></script>
27+
<script src="{{ '/assets/js/progressbar.js' | relative_url }}"></script>
2828
{% endif %}
2929

3030
{% if site.enable_tooltips %}

_includes/news.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h2>news</h2>
1111
{% if item.inline %}
1212
{{ item.content | remove: '<p>' | remove: '</p>' | emojify }}
1313
{% else %}
14-
<a class="news-title" href="{{ item.url | prepend: site.baseurl }}">{{ item.title }}</a>
14+
<a class="news-title" href="{{ item.url | relative_url }}">{{ item.title }}</a>
1515
{% endif %}
1616
</td>
1717
</tr>

_includes/pagination.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<nav aria-label="Blog page naviation">
33
<ul class="pagination pagination-lg justify-content-center">
44
<li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
5-
<a class="page-link" href="{{ paginator.previous_page_path | prepend: site.baseurl }}" tabindex="-1" aria-disabled="{{ paginator.previous_page }}">Newer</a>
5+
<a class="page-link" href="{{ paginator.previous_page_path | relative_url }}" tabindex="-1" aria-disabled="{{ paginator.previous_page }}">Newer</a>
66
</li>
77
{% if paginator.page_trail %}
88
{% for trail in paginator.page_trail %}
9-
<li class="page-item {% if page.url == trail.path %}active{% endif %}"><a class="page-link" href="{{ trail.path | prepend: site.baseurl }}" title="{{trail.title}}">{{ trail.num }}</a></li>
9+
<li class="page-item {% if page.url == trail.path %}active{% endif %}"><a class="page-link" href="{{ trail.path | relative_url }}" title="{{trail.title}}">{{ trail.num }}</a></li>
1010
{% endfor %}
1111
{% endif %}
1212
<li class="page-item {% unless paginator.next_page %}disabled{% endunless %}">
13-
<a class="page-link" href="{{ paginator.next_page_path | prepend: site.baseurl }}">Older</a>
13+
<a class="page-link" href="{{ paginator.next_page_path | relative_url }}">Older</a>
1414
</li>
1515
</ul>
1616
</nav>

_layouts/about.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{% if page.profile %}
1010
<div class="profile col-4 {% if page.profile.align == 'left' %}order-first{% endif %}">
1111
{% if page.profile.image %}
12-
<img class="img-fluid z-depth-1 rounded" src="{{ page.profile.image | prepend: '/assets/img/' | prepend: site.baseurl | prepend: site.url }}">
12+
<img class="img-fluid z-depth-1 rounded" src="{{ page.profile.image | prepend: '/assets/img/' | relative_url }}">
1313
{% endif %}
1414
{% if page.profile.address %}
1515
<div class="address">

_layouts/bib.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<em>{{author.last}}, {{author.first}}</em>,
2929
{% else %}
3030
{% if site.data.coauthors[author.last] %}
31-
<a href="{{site.data.coauthors[author.last].url}}" target="_blank">{{author.last}}, {{author.first}}</a>,
31+
<a href="{{site.data.coauthors[author.last].url}}" target="_blank">{{author.last}}, {{author.first}}</a>,
3232
{% else %}
3333
{{author.last}}, {{author.first}},
3434
{% endif %}
@@ -38,7 +38,7 @@
3838
and <em>{{author.last}}, {{author.first}}</em>
3939
{% else %}
4040
{% if site.data.coauthors[author.last] %}
41-
and <a href="{{site.data.coauthors[author.last].url}}" target="_blank">{{author.last}}, {{author.first}}</a>
41+
and <a href="{{site.data.coauthors[author.last].url}}" target="_blank">{{author.last}}, {{author.first}}</a>
4242
{% else %}
4343
and {{author.last}}, {{author.first}}
4444
{% endif %}
@@ -71,16 +71,16 @@
7171
[<a href="{{ entry.html }}" target="_blank">HTML</a>]
7272
{% endif %}
7373
{% if entry.pdf %}
74-
[<a href="{{ entry.pdf | prepend: '/assets/pdf/' | prepend: site.baseurl | prepend: site.url }}" target="_blank">PDF</a>]
74+
[<a href="{{ entry.pdf | prepend: '/assets/pdf/' | relative_url }}" target="_blank">PDF</a>]
7575
{% endif %}
7676
{% if entry.supp %}
77-
[<a href="{{ entry.supp | prepend: '/assets/pdf/' | prepend: site.baseurl | prepend: site.url }}" target="_blank">Supp</a>]
77+
[<a href="{{ entry.supp | prepend: '/assets/pdf/' | relative_url }}" target="_blank">Supp</a>]
7878
{% endif %}
7979
{% if entry.poster %}
80-
[<a href="{{ entry.poster | prepend: '/assets/pdf/' | prepend: site.baseurl | prepend: site.url }}" target="_blank">Poster</a>]
80+
[<a href="{{ entry.poster | prepend: '/assets/pdf/' | relative_url }}" target="_blank">Poster</a>]
8181
{% endif %}
8282
{% if entry.slides %}
83-
[<a href="{{ entry.slides | prepend: '/assets/pdf/' | prepend: site.baseurl | prepend: site.url }}" target="_blank">Slides</a>]
83+
[<a href="{{ entry.slides | prepend: '/assets/pdf/' | relative_url }}" target="_blank">Slides</a>]
8484
{% endif %}
8585
{% if entry.code %}
8686
[<a href="{{ entry.code }}" target="_blank">Code</a>]

_layouts/default.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313

1414
<!-- Content -->
1515

16-
<div class="container mt-5">
16+
<div class="container mt-1">
1717
{{ content }}
1818
</div>
1919

2020
<!-- Footer -->
2121

2222
{% include footer.html %}
2323

24-
{% include hemline.html %}
25-
2624
</body>
2725

26+
{% include hemline.html %}
27+
2828
</html>

_layouts/distill.html

+38-25
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
<html>
33
<head>
44
{% include head.html %}
5-
<script src="{{ '/assets/js/distill.js' | prepend: site.baseurl | prepend: site.url }}"></script>
5+
<script src="{{ '/assets/js/distillpub/template.v2.js' | relative_url }}"></script>
6+
<script src="{{ '/assets/js/distillpub/transforms.v2.js' | relative_url }}"></script>
7+
{% if page._styles %}
8+
<style type="text/css">
9+
{{ page._styles }}
10+
</style>
11+
{% endif %}
612
</head>
713

814
<d-front-matter>
@@ -14,15 +20,13 @@
1420
{% for author in page.authors %}
1521
{
1622
"author": "{{ author.name }}",
17-
"authorURL": "{{ author.url }}"
18-
}{% if forloop.last == false %},{% endif %}
19-
{% endfor %}
20-
],
21-
"editors": [
22-
{% for editor in page.editors %}
23-
{
24-
"editor": "{{ editor.name }}",
25-
"editorURL": "{{ editor.url }}"
23+
"authorURL": "{{ author.url }}",
24+
"affiliations": [
25+
{
26+
"name": "{{ author.affiliations.name }}",
27+
"url": "{{ author.affiliations.url }}"
28+
}
29+
]
2630
}{% if forloop.last == false %},{% endif %}
2731
{% endfor %}
2832
],
@@ -43,38 +47,47 @@
4347
}</script>
4448
</d-front-matter>
4549

46-
<body>
50+
<body class="{% if site.navbar_fixed %}fixed-top-nav{% endif %} {% unless site.footer_fixed %}sticky-bottom-footer{% endunless %}">
51+
52+
<!-- Header -->
4753

4854
{% include header.html %}
4955

56+
<!-- Content -->
57+
58+
<div class="container-fluid mt-5">
5059

51-
<div class="page-content">
60+
<div class="post distill">
5261

53-
<d-title>
54-
<h1>{{ page.title }}</h1>
55-
<p>{{ page.description }}</p>
56-
</d-title>
62+
<d-title>
63+
<h1>{{ page.title }}</h1>
64+
<p>{{ page.description }}</p>
65+
</d-title>
5766

58-
<d-byline></d-byline>
67+
<d-byline></d-byline>
5968

60-
<d-article>
61-
{{ content }}
62-
</d-article>
69+
<d-article>
70+
{{ content }}
71+
</d-article>
6372

64-
<d-appendix>
65-
<d-footnote-list></d-footnote-list>
66-
<d-citation-list></d-citation-list>
67-
</d-appendix>
73+
<d-appendix>
74+
<d-footnote-list></d-footnote-list>
75+
<d-citation-list></d-citation-list>
76+
</d-appendix>
77+
78+
</div>
6879

6980
</div>
7081

82+
<!-- Footer -->
83+
7184
{% include footer.html %}
7285

7386
</body>
7487

7588
{% include hemline.html %}
7689

77-
<d-bibliography src="{{ page.bibliography | prepend: '/assets/distill/' | prepend: site.baseurl | prepend: site.url }}">
90+
<d-bibliography src="{{ page.bibliography | prepend: '/assets/bibliography/' | relative_url }}">
7891
</d-bibliography>
7992

8093
</html>

_layouts/post.html

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
---
22
layout: default
33
---
4+
5+
{% if page._styles %}
6+
<style type="text/css">
7+
{{ page._styles }}
8+
</style>
9+
{% endif %}
10+
411
<div class="post">
512

613
<header class="post-header">

_pages/projects.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ nav: true
1313
<div class="thumbnail">
1414
<a href="{{ project.redirect }}" target="_blank">
1515
{% if project.img %}
16-
<img class="thumbnail" src="{{ project.img | prepend: site.baseurl | prepend: site.url }}"/>
16+
<img class="thumbnail" src="{{ project.img | relative_url }}"/>
1717
{% else %}
1818
<div class="thumbnail blankbox"></div>
1919
{% endif %}
@@ -29,9 +29,9 @@ nav: true
2929

3030
<div class="project ">
3131
<div class="thumbnail">
32-
<a href="{{ project.url | prepend: site.baseurl | prepend: site.url }}">
32+
<a href="{{ project.url | relative_url }}">
3333
{% if project.img %}
34-
<img class="thumbnail" src="{{ project.img | prepend: site.baseurl | prepend: site.url }}"/>
34+
<img class="thumbnail" src="{{ project.img | relative_url }}"/>
3535
{% else %}
3636
<div class="thumbnail blankbox"></div>
3737
{% endif %}

0 commit comments

Comments
 (0)