Skip to content

Commit 80e2c41

Browse files
committed
Make scroll to posts id a global site variable, apply id to featured hero / pagination
1 parent 23635f6 commit 80e2c41

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ permalink: "/blog/:year/:title:output_ext"
3232
date_format: "%B %-d, %Y"
3333
paginate: 12
3434
paginate_path: "/blog/page:num/"
35+
post-id: "#posts"
3536

3637
# Build settings
3738
plugins:

_includes/featured-post-hero.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ <h3 class="section-heading mb-0 text-plum">Featured Series</h3>
6969

7070
<!-- All posts button (if not on a blog page already) -->
7171
{% unless page.url contains "blog" %}
72-
<a href="{% link blog/index.html %}#all-posts" class="mt-4 btn btn-primary btn-icon-right">
72+
<a href="{% link blog/index.html %}{{ site.post-id }}" class="mt-4 btn btn-primary btn-icon-right">
7373
All Posts
7474
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/icon-sprite.svg#arrow-right' | relative_url }}"></use></svg>
7575
</a>

_includes/pagination.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!-- Previous arrow -->
66
{% if paginator.previous_page %}
77
<li class="pagination__item">
8-
<a class="older-posts" href="{{ paginator.previous_page_path | relative_url }}">
8+
<a class="pagination__link" href="{{ paginator.previous_page_path | relative_url }}{{ site.post-id }}">
99
<span class="visually-hidden">Previous Page</span>
1010
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/icon-sprite.svg#arrow-left' | relative_url }}"></use></svg>
1111
</a>
@@ -24,13 +24,13 @@
2424

2525
<!-- Page 1 -->
2626
{% if page == 1 %}
27-
<a class="pagination__link {{ class }}" href="{{ paginator.previous_page_path | relative_url }}" {{ aria }}>
27+
<a class="pagination__link {{ class }}" href="{{ paginator.previous_page_path | relative_url }}{{ site.post-id }}" {{ aria }}>
2828
<span class="visually-hidden">Page </span>{{ page }}
2929
</a>
3030

3131
<!-- Page 2, 3, 4, etc -->
3232
{% else %}
33-
<a class="pagination__link {{ class }}" href="{{ site.paginate_path | relative_url | replace: ':num', page }}" {{ aria }}>
33+
<a class="pagination__link {{ class }}" href="{{ site.paginate_path | relative_url | replace: ':num', page }}{{ site.post-id }}" {{ aria }}>
3434
<span class="visually-hidden">Page </span>{{ page }}
3535
</a>
3636

@@ -41,7 +41,7 @@
4141
<!-- Next arrow -->
4242
{% if paginator.next_page %}
4343
<li class="pagination__item">
44-
<a class="older-posts" href="{{ paginator.next_page_path | relative_url }}">
44+
<a class="pagination__link" href="{{ paginator.next_page_path | relative_url }}{{ site.post-id }}">
4545
<span class="visually-hidden">Next Page</span>
4646
<svg class="svg-icon"><use xlink:href="{{ '/assets/images/icons/icon-sprite.svg#arrow-right' | relative_url }}"></use></svg>
4747
</a>

assets/_sass/component/_pagination.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
margin: rem-calc(0 5px 5px 0);
1111
}
1212

13-
.pagination a {
13+
.pagination__link {
1414
display: inline-block;
1515
padding: rem-calc(4px);
1616
min-width: rem-calc(36px);

0 commit comments

Comments
 (0)