Skip to content

Commit 49ef78c

Browse files
committed
first pass at handling a dynamic Sitemap
1 parent 5afdf26 commit 49ef78c

10 files changed

+90
-17
lines changed

_config.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ plugins:
2626
defaults:
2727
-
2828
scope:
29-
path: "" # an empty string here means all files in the project
29+
path: "*.html" # an empty string here means all files in the project
3030
values:
3131
# Page Variables
3232
image: img/logo.png
@@ -41,7 +41,9 @@ defaults:
4141
progress_tweet: "Thanks for accepting Bitcoin Cash, @TWITTERHANDLE!"
4242
hash: "acceptBitcoinCash, BCHforEveryone"
4343
has_search: yes
44-
list_of: "merchant"
44+
has_nav: yes
45+
has_ticker: yes
46+
list_of: "merchants"
4547
encoded_img_placeholder: "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
4648
img_placeholder: "/img/placeholder.png"
4749

_layouts/default.html

+7-10
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,21 @@
5555
{% include js-warning.html %}
5656
{% include header.html %}
5757

58-
{%- include segment/navbar.html -%}
58+
{%- if page.has_nav -%}
59+
{%- include segment/navbar.html -%}
60+
{%- endif -%}
5961

6062
<!-- 'content' loads pages from the root (index.html/*.html) -->
6163
{{ content }}
6264

63-
{%- if page.page_name == "home" -%}
64-
{% include segment/twitter.html %}
65-
{% include segment/moreinfo.html %}
66-
{% include segment/assets.html %}
67-
{%- elsif page.page_name == "adult" -%}
68-
{% include modals/adult-warning.html %}
69-
{%- endif -%}
7065

66+
{%- if page.has_ticker -%}
67+
{% include segment/ticker.html %}
68+
{%- endif -%}
7169
<!-- Global includes -->
72-
{% include modals/disclaimer.html %}
73-
{% include segment/ticker.html %}
7470
{% include fab.html %}
7571
{% include footer.html %}
72+
{% include modals/disclaimer.html %}
7673
{% include scripts.html %}
7774
</body>
7875
</html>

_layouts/listings.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
layout: default
3+
link_tweet: "Tweet to @TWITTERHANDLE"
4+
link_facebook: "Write on @FACEBOOKHANDLE's wall"
5+
email_subject: "Please%20consider%20accepting%20Bitcoin%20Cash%20payments"
6+
rtfm: "Read support docs from"
7+
link_mobile: "TWEET THEM"
8+
workonit_tweet: "Please consider accepting #BitcoinCash for payments @TWITTERHANDLE - it’s \"Peer-to-Peer Electronic Cash\" that is fast, reliable, and secure, with low fees. More @"
9+
link_progress: "Thank them for accepting Bitcoin Cash"
10+
link_progress_mobile: "THANK THEM"
11+
progress_tweet: "Thanks for accepting Bitcoin Cash, @TWITTERHANDLE!"
12+
hash: "acceptBitcoinCash, BCHforEveryone"
13+
has_search: yes
14+
has_nav: yes
15+
---
16+
{{content}}

adoption.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
layout: default
3+
title: Adoption
34

45
id: adoption
56
page_name: adoption

adult.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
2-
layout: default
2+
layout: listings
3+
title: Adult
34

45
id: adult-listings
56
page_name: adult
67
list_of: "adult website"
78
---
89

910
{% include segment/listings.html %}
11+
12+
{% include modals/adult-warning.html %}

donations.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
2-
layout: default
2+
layout: listings
3+
title: Donations
34

45
id: donation-listings
56
page_name: donations
6-
list_of: "organization"
7+
list_of: "organizations"
78
email_subject: Please%20consider%20accepting%20Bitcoin%20Cash%20donations
89
workonit_tweet: "Please consider accepting #BitcoinCash for donations @TWITTERHANDLE - it’s \"Peer-to-Peer Electronic Cash\" that is fast, reliable, and secure, with low fees. More @"
910
---

index.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
---
2-
layout: default
2+
layout: listings
3+
title: The Accept Bitcoin Cash Initiative
34

45
id: home
56
page_name: home
67
---
78

89
{% include segment/listings.html %}
10+
11+
{% include segment/twitter.html %}
12+
{% include segment/moreinfo.html %}
13+
{% include segment/assets.html %}

js/ticker.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@ $(document).ready(function () {
4545
});
4646
}
4747

48-
ticker(ticker_currencies);
48+
// Only do something if we see the element exists (this prevents errors
49+
if($('#ticker_value').length) {
50+
ticker(ticker_currencies);
51+
}
4952
});

robots.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
sitemap: false
23
---
34
{%- capture disallow_val -%}
45
{%- if site.GH_ENV == 'gh_pages' -%}/{%- endif -%}

sitemap.html

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
layout: default
3+
has_search: false
4+
has_nav: false
5+
has_ticker: false
6+
title: Sitemap
7+
---
8+
<h1 class="ui center aligned header">Sitemap</h1>
9+
<br/>
10+
<div class="ui container">
11+
<div class="container-inner ui stackable grid">
12+
{%- assign pages_layouts = site.pages | group_by: "layout" -%}
13+
{%- for pages in pages_layouts -%}
14+
{%- assign show_sitemap_section = true -%}
15+
{%- case pages.name -%}
16+
{%- when "default" -%}
17+
{%- assign page_name = "Information" -%}
18+
{%- when "listings" -%}
19+
{%- assign page_name = "Directories" -%}
20+
{%- when "json" -%}
21+
{%- assign page_name = "JSON Endpoints" -%}
22+
{%- else -%}
23+
{%- assign page_name = pages.name -%}
24+
{%- if page_name == "" -%}
25+
{%- assign show_sitemap_section = false -%}
26+
{%- endif -%}
27+
{%- endcase -%}
28+
{%- if show_sitemap_section == true -%}
29+
<div class="eight wide column">
30+
<h2>{{page_name}}</h2>
31+
<ul>
32+
{%- for page in pages.items -%}
33+
{%- assign include_page = page.sitemap -%}
34+
{%- if include_page != false -%}
35+
<li><a href="{{page.url}}" alt="{{page.name}}">{{page.title | default: page.name }}</a></li>
36+
37+
{%- endif -%}
38+
{%- endfor -%}
39+
</ul></div>
40+
{%- endif -%}
41+
{%- endfor -%}
42+
</div>
43+
</div>
44+
<br/>

0 commit comments

Comments
 (0)