Skip to content

Commit 6d3e71c

Browse files
committed
refactor includes, smooth scroll on page change
1 parent b7e2fbf commit 6d3e71c

16 files changed

+59
-18
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

_includes/docs.html renamed to _includes/docs/docs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="doc-contents">
44
<h2>Contents</h2>
55
{% for doc in site.categories[include.category] reversed %}
6-
{% include table-of-contents.html
6+
{% include docs/doc-index.html
77
link=doc.link
88
title=doc.title
99
index=forloop.index
@@ -16,7 +16,7 @@ <h2>Contents</h2>
1616
<!-- Docs -->
1717
<div>
1818
{% for doc in site.categories[include.category] reversed %}
19-
{% include doc.html
19+
{% include docs/doc.html
2020
link=doc.link
2121
title=doc.title
2222
content=doc.content

_layouts/default.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
-->
88
<html>
99

10-
{% include head.html %}
10+
{% include base/head.html %}
1111

1212
<body>
1313

1414
<!-- Page Wrapper -->
1515
<div id="page-wrapper">
1616

17-
{% include header.html %}
17+
{% include base/header.html %}
1818
{{ content }}
19-
{% include footer.html %}
20-
{% include scripts.html %}
19+
{% include base/footer.html %}
20+
{% include base/scripts.html %}
2121

2222
</div>
2323

_layouts/landing.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
-->
88
<html>
99

10-
{% include head.html %}
10+
{% include base/head.html %}
1111

1212
<body class="landing">
1313

1414
<!-- Page Wrapper -->
1515
<div id="page-wrapper">
1616

17-
{% include header.html %}
17+
{% include base/header.html %}
1818
{{ content }}
19-
{% include footer.html %}
20-
{% include scripts.html %}
19+
{% include base/footer.html %}
20+
{% include base/scripts.html %}
2121

2222
</div>
2323

_sass/_custom.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
opacity: 0.85;
88
}
99

10+
a.smooth:hover {
11+
color: red;
12+
}
13+
1014
.doc-contents {
1115
padding-left: 30px;
1216
}

atom-coderoad.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@
55
repo: //github.com/coderoad/atom-coderoad
66
---
77

8-
{% include docs.html category="atom-coderoad" %}
8+
{% include docs/docs.html category="atom-coderoad" %}
9+
10+
<!-- <script>if (reSmooth.test(/^#/)) {
11+
let id = '#' + location.hash.replace(reSmooth, '');
12+
$.smoothScroll({scrollTarget: id});
13+
}</script> -->

builder-coderoad.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
repo: //github.com/coderoad/builder-coderoad
66
---
77

8-
{% include docs.html category="builder-coderoad" %}
8+
{% include docs/docs.html category="builder-coderoad" %}
99
<!--
1010
<ul>
1111
<li>Installation</li>

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<h2>{{ site.title }}</h2>
99
<p>{{ site.description | markdownify }}</p>
1010
<ul class="actions">
11-
<li><a href="/atom-coderoad.html" class="button special">Quick Start</a></li>
11+
<li><a href="/atom-coderoad.html#install" class="button special">Quick Start</a></li>
1212
</ul>
1313
</div>
1414
<a href="#one" class="more scrolly">Learn More</a>
@@ -91,7 +91,7 @@ <h2>Accelerated Education</h2>
9191
<p>Find out more about how to setup CodeRoad and get started learning and creating.</p>
9292
</header>
9393
<ul class="actions vertical">
94-
<li><a href="/atom-coderoad.html" class="button fit special">Quick Start</a></li>
94+
<li><a href="/atom-coderoad.html#install" class="button fit special">Quick Start</a></li>
9595
<li><a href="/overview.html" class="button fit">Overview</a></li>
9696
</ul>
9797
</div>

js/modals.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,36 @@ $(function() {
3333
preventDefault: true
3434
});
3535

36+
37+
const scrollnow = function(e) {
38+
var target;
39+
if (e) {
40+
e.preventDefault();
41+
target = this.hash;
42+
} else {
43+
target = location.hash;
44+
}
45+
$.smoothScroll({
46+
offset: -70,
47+
easing: 'swing',
48+
speed: 400,
49+
autoCoefficient: 2,
50+
preventDefault: true,
51+
scrollTarget: target
52+
});
53+
};
54+
55+
if (location.hash) {
56+
$('html, body').scrollTop(0).show();
57+
scrollnow();
58+
}
59+
60+
$('a[href*="/"][href*=#]').each(function(){
61+
if (this.pathname.replace(/^\//,'') == location.pathname.replace(/^\//,'') && this.hostname == location.hostname) {
62+
$(this).attr("href", this.hash);
63+
}
64+
});
65+
66+
$('a[href^=#]:not([href=#])').click(scrollnow);
67+
3668
});

js/modals.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tutorial-docs.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
<section id="suggestions">
1313
<ul class="actions" style="text-align: center;">
1414
<li>
15-
<a class="button special" href="/atom-coderoad.html">Quick Start</a>
15+
<a class="button special" href="/atom-coderoad.html#install">Quick Start</a>
1616
</li>
1717
<li>
18-
<a class="button" href="/builder-coderoad.html">Builder Start</a>
18+
<a class="button" href="/builder-coderoad.html#install">Builder Start</a>
1919
</li>
2020
<li>
2121
<a class="button" href="/overview.html">Overview</a>
2222
</li>
2323
</ul>
2424
</section>
2525

26-
{% include docs.html category="tutorial-docs" %}
26+
{% include docs/docs.html category="tutorial-docs" %}
2727

2828
</div>

0 commit comments

Comments
 (0)