From bc301594525a99795059df48f534810acc0eda22 Mon Sep 17 00:00:00 2001 From: HM Rando Date: Sun, 12 Apr 2026 12:20:49 -0400 Subject: [PATCH 1/3] Separate course and news excerpt rendering --- _includes/course-excerpt.html | 65 +++++++++++++++++++++++++++++++++++ teaching/index.md | 2 +- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 _includes/course-excerpt.html diff --git a/_includes/course-excerpt.html b/_includes/course-excerpt.html new file mode 100644 index 00000000..59525d96 --- /dev/null +++ b/_includes/course-excerpt.html @@ -0,0 +1,65 @@ +
+ {% assign course_website = include.course_website | default: empty %} + {% assign url = include.url | default: include.link | default: course_website %} + {% assign title = include.title | default: "[no course title]" %} + {% assign subtitle = include.subtitle %} + {% capture display_title %} + {% if subtitle %}{{ subtitle }}: {% endif %}{{ title }} + {% endcapture %} + {% if url %} + {{ display_title | strip }} + {% else %} + {{ display_title | strip }} + {% endif %} + + {% if course_website %} +

+ Course website: + {{ course_website }} +

+ {% endif %} + + {% if include.distribution %} +

Distribution: {{ include.distribution }}

+ {% endif %} + + {% if include.next_offered %} +

Next offering: {{ include.next_offered }}

+ {% endif %} + + {% assign terms_offered = include.terms_offered | default: empty %} + {% if terms_offered.size > 0 %} + {% assign teaching_link = "/teaching" | relative_url %} +

Previously offered:

+
+ {% for term in terms_offered %} + + {{ term }} + + {% endfor %} +
+ {% endif %} + + {% assign body = include.content | default: "" %} + {% if body != "" %} + {% assign excerpt = body + | regex_scan: "(.*)", true + | default: include.excerpt + | default: include.description + | default: "" + | strip_html + %} + {% assign search = body + | strip_html + | strip_newlines + | regex_strip + %} +

+ {{ excerpt }} +

+ {% endif %} +
diff --git a/teaching/index.md b/teaching/index.md index d84d5a6e..51d87c38 100644 --- a/teaching/index.md +++ b/teaching/index.md @@ -17,4 +17,4 @@ Here is some information about the classes that Prof. Rando has taught at Smith. {% include search-info.html %} -{% include list.html data="courses" component="post-excerpt" %} +{% include list.html data="courses" component="course-excerpt" %} From 566d5c8528bd5f7fdb95ad22698d937b4f02fb39 Mon Sep 17 00:00:00 2001 From: HM Rando Date: Sun, 12 Apr 2026 13:14:47 -0400 Subject: [PATCH 2/3] Fix list include indentation rendering --- _includes/list.html | 72 ++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/_includes/list.html b/_includes/list.html index eba382bc..037de2f7 100644 --- a/_includes/list.html +++ b/_includes/list.html @@ -21,42 +21,40 @@ {% for d in data %} {% assign style = d.style | default: include.style %} - - {% - include {{ include.component | append: ".html" }} - author=d.author - authors=d.authors - buttons=d.buttons - caption=d.caption - course_website=d.course_website - content=d.content - date=d.date - description=d.description - distribution=d.distribution - excerpt=d.excerpt - height=d.height - icon=d.icon - id=d.id - image=d.image - last_modified_at=d.last_modified_at - link=d.link - lookup=d.lookup - name=d.name - publisher=d.publisher - repo=d.repo - role=d.role - slug=d.slug - style=style - subtitle=d.subtitle - tags=d.tags - terms_offered=d.terms_offered - text=d.text - next_offered=d.next_offered - title=d.title - tooltip=d.tooltip - type=d.type - url=d.url - width=d.width - %} +{% include {{ include.component | append: ".html" }} + author=d.author + authors=d.authors + buttons=d.buttons + caption=d.caption + course_website=d.course_website + content=d.content + date=d.date + description=d.description + distribution=d.distribution + excerpt=d.excerpt + height=d.height + icon=d.icon + id=d.id + image=d.image + last_modified_at=d.last_modified_at + link=d.link + lookup=d.lookup + name=d.name + publisher=d.publisher + repo=d.repo + role=d.role + slug=d.slug + style=style + subtitle=d.subtitle + tags=d.tags + terms_offered=d.terms_offered + text=d.text + next_offered=d.next_offered + title=d.title + tooltip=d.tooltip + type=d.type + url=d.url + width=d.width +%} {% endfor %} {% endfor %} From 01be1533079ed6b510022e5c75e409c3c4c25847 Mon Sep 17 00:00:00 2001 From: HM Rando Date: Sun, 12 Apr 2026 14:06:24 -0400 Subject: [PATCH 3/3] Make next offering filterable --- _includes/course-excerpt.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/_includes/course-excerpt.html b/_includes/course-excerpt.html index 59525d96..e0597694 100644 --- a/_includes/course-excerpt.html +++ b/_includes/course-excerpt.html @@ -23,13 +23,22 @@

Distribution: {{ include.distribution }}

{% endif %} + {% assign teaching_link = "/teaching" | relative_url %} {% if include.next_offered %} -

Next offering: {{ include.next_offered }}

+

Next offering:

+ {% endif %} {% assign terms_offered = include.terms_offered | default: empty %} {% if terms_offered.size > 0 %} - {% assign teaching_link = "/teaching" | relative_url %}

Previously offered:

{% for term in terms_offered %}