Skip to content

Commit 2d7ef92

Browse files
committed
prereqs for more buddhist highlights
1 parent 2737c23 commit 2d7ef92

6 files changed

Lines changed: 66 additions & 45 deletions

File tree

‎Gemfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ gem "jekyll-sass-converter", ">= 3.0", "< 4.0"
2020
group :jekyll_plugins do
2121
gem "jekyll-feed", github: 'buddhist-uni/jekyll-feed', branch: 'collection-tags'
2222
gem "jekyll-sitemap", "~> 1.4.0"
23-
gem "jekyll-seo-tag", github: "buddhist-uni/jekyll-seo-tag", ref: '9d3cf62'
23+
gem "jekyll-seo-tag", github: "buddhist-uni/jekyll-seo-tag", ref: '5a9a962'
2424
gem "jekyll-last-modified-at", github: "buddhist-uni/jekyll-last-modified-at", branch: 'post-date'
2525
gem 'jekyll-include-cache'
2626
end

‎Gemfile.lock‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ GIT
1717

1818
GIT
1919
remote: https://github.com/buddhist-uni/jekyll-seo-tag.git
20-
revision: 9d3cf620ed53cc2b0d0f5a6cefffed2aeb34289b
21-
ref: 9d3cf62
20+
revision: 5a9a962027516970a0983d3ed5b006d363504aa7
21+
ref: 5a9a962
2222
specs:
2323
jekyll-seo-tag (2.7.1)
2424
jekyll (>= 3.8, < 5.0)

‎_includes/big_content_table.html‎

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,44 +35,7 @@
3535
{%- include_cached content_authors_string.html authors=translators -%}
3636
{%- endif -%}
3737
</td>
38-
{%- assign primarytag = false -%}
39-
{%- assign ordinality = 9999 -%}
40-
{%- if p.course -%}
41-
{%- for candidatecourse in site.courses -%}
42-
{%- if p.course == candidatecourse.slug -%}
43-
{%- capture primarytag -%}<a href="{{ candidatecourse.url }}">
44-
<i class="{{ candidatecourse.icon }}"></i>
45-
{{ candidatecourse.title | escape }}
46-
</a>{%- endcapture -%}
47-
{%- assign ordinality = forloop.index -%}
48-
{%- break -%}
49-
{%- endif -%}
50-
{%- endfor -%}
51-
{%- unless primarytag -%}
52-
{%- for candidatetag in site.tags -%}
53-
{%- if candidatetag.slug == p.course -%}
54-
{%- capture primarytag -%}<a href="{{ candidatetag.url }}">
55-
<i class="fas fa-tag"></i>
56-
{{ candidatetag.title | escape }}
57-
</a>{%- endcapture -%}
58-
{%- assign ordinality = forloop.index | plus: site.courses.size -%}
59-
{%- break -%}
60-
{%- endif -%}
61-
{%- endfor -%}
62-
{%- endunless -%}
63-
{%- endif -%}
64-
{%- unless primarytag -%}
65-
{%- for candidatetag in site.tags -%}
66-
{%- if p.tags contains candidatetag.slug -%}
67-
{%- capture primarytag -%}<a href="{{ candidatetag.url }}">
68-
<i class="fas fa-tag"></i>
69-
{{ candidatetag.title | escape }}
70-
</a>{%- endcapture -%}
71-
{%- assign ordinality = forloop.index | plus: site.courses.size -%}
72-
{%- break -%}
73-
{%- endif -%}
74-
{%- endfor -%}
75-
{%- endunless -%}
38+
{%- include content_primarytag_ordinality.liquid item=p -%}
7639
<td data-order="{{ ordinality }}">
7740
{%- if primarytag -%}
7841
{{ primarytag }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{%- assign primarytag = false -%}
2+
{%- assign ordinality = 9999 -%}
3+
{%- if include.item.course -%}
4+
{%- for candidatecourse in site.courses -%}
5+
{%- if include.item.course == candidatecourse.slug -%}
6+
{%- capture primarytag -%}<a href="{{ candidatecourse.url }}">
7+
<i class="{{ candidatecourse.icon }}"></i>
8+
{{ candidatecourse.title | escape }}
9+
</a>{%- endcapture -%}
10+
{%- assign ordinality = forloop.index -%}
11+
{%- break -%}
12+
{%- endif -%}
13+
{%- endfor -%}
14+
{%- unless primarytag -%}
15+
{%- for candidatetag in site.tags -%}
16+
{%- if candidatetag.slug == include.item.course -%}
17+
{%- capture primarytag -%}<a href="{{ candidatetag.url }}">
18+
<i class="fas fa-tag"></i>
19+
{{ candidatetag.title | escape }}
20+
</a>{%- endcapture -%}
21+
{%- assign ordinality = forloop.index | plus: site.courses.size -%}
22+
{%- break -%}
23+
{%- endif -%}
24+
{%- endfor -%}
25+
{%- endunless -%}
26+
{%- endif -%}
27+
{%- unless primarytag -%}
28+
{%- for candidatetag in site.tags -%}
29+
{%- if include.item.tags contains candidatetag.slug -%}
30+
{%- capture primarytag -%}<a href="{{ candidatetag.url }}">
31+
<i class="fas fa-tag"></i>
32+
{{ candidatetag.title | escape }}
33+
</a>{%- endcapture -%}
34+
{%- assign ordinality = forloop.index | plus: site.courses.size -%}
35+
{%- break -%}
36+
{%- endif -%}
37+
{%- endfor -%}
38+
{%- endunless -%}

‎scripts/website.py‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,20 @@ def sortChildren(self):
9494
def get(self, tag: str):
9595
return self.tags.get(tag)
9696
def __iter__(self):
97-
return iter(self.tags.values())
97+
for filename in config['collections']['tags']['order']:
98+
yield self.tags[filename[:-3]]
9899
def __len__(self):
99100
return len(self.tags)
100101
def __contains__(self, item):
101102
if isinstance(item, TagFile):
102103
return item.slug in self.tags
103104
return bool(self.get(item))
104105

106+
content = []
107+
tags = TagCollection()
108+
authors = AuthorCollection()
109+
courses = []
110+
105111
class ContentFile(JekyllFile):
106112
def __init__(self, fd: Path, content, handler=None, **kwargs) -> None:
107113
fd = Path(fd)
@@ -138,9 +144,19 @@ def external_url_linkfmt(self):
138144
return "YouTube (link)"
139145
return ""
140146

141-
content = []
142-
tags = TagCollection()
143-
authors = AuthorCollection()
147+
def primarytag_ordinality(self) -> tuple[str, int]:
148+
"""Mirrors the logic of _include/content_primarytag_ordinality.liquid"""
149+
if self.course:
150+
for idx, candidatecourse in enumerate(courses):
151+
if self.course == candidatecourse.slug:
152+
return (self.course, idx)
153+
for idx, candidatetag in enumerate(tags):
154+
if candidatetag.slug == self.course:
155+
return (self.course, idx+len(courses))
156+
for idx, candidatetag in enumerate(tags):
157+
if candidatetag.slug in self.tags:
158+
return (candidatetag.slug, idx+len(courses))
159+
return (False, 9999)
144160

145161
def entry_with_drive_id(gid):
146162
for entry in content:
@@ -174,6 +190,9 @@ def load():
174190
if content:
175191
return
176192
filecreationtimes.update(get_file_creation_times())
193+
for filepath in root_folder.joinpath("_courses").rglob("*.md"):
194+
courses.append(JekyllFile.load(filepath))
195+
courses.sort(key=lambda c: c.created_at)
177196
for contentfolder in root_folder.joinpath('_content').iterdir():
178197
if (not contentfolder.is_dir()) or contentfolder.name.startswith('.'):
179198
continue

‎search.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
slug: search
44
section: search
55
custom_css: ["search"]
6+
canonical_url: "none"
67
---
78
<search>
89
<form class="TableObject" id="search" action="/search/" method="GET">

0 commit comments

Comments
 (0)