Skip to content

Commit 4e99d0e

Browse files
committed
Fix workshop sorting and JavaScript paths for GitHub Pages
- Add case-insensitive title matching for workshop sorting - Fix relative URLs for JavaScript and CSS files - Update workshop-status.js to detect base URL dynamically - Improve title normalization to handle different formats
1 parent f9baaff commit 4e99d0e

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

_includes/workshop-list-sorted.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@
1111
{% comment %} Separate workshops into active and inactive {% endcomment %}
1212
{% for workshop in workshops %}
1313
{% assign is_active = false %}
14+
{% assign workshop_title_lower = workshop.title | downcase %}
1415

1516
{% comment %} Check if workshop is in upcoming workshops {% endcomment %}
1617
{% for upcoming in site.data.upcoming_workshops.workshops %}
17-
{% if upcoming.title == workshop.title %}
18+
{% assign upcoming_title_lower = upcoming.title | downcase %}
19+
{% if upcoming_title_lower == workshop_title_lower %}
20+
{% assign is_active = true %}
21+
{% break %}
22+
{% elsif upcoming_title_lower contains workshop_title_lower %}
23+
{% assign is_active = true %}
24+
{% break %}
25+
{% elsif workshop_title_lower contains upcoming_title_lower %}
1826
{% assign is_active = true %}
1927
{% break %}
2028
{% endif %}

_layouts/default.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>{{ page.title | default: "D-Lab Workshops" }}</title>
8-
<link rel="icon" type="image/png" sizes="32x32" href="static/images/favicon-32x32.png">
9-
<link rel="icon" type="image/png" sizes="16x16" href="static/images/favicon-16x16.png">
8+
<link rel="icon" type="image/png" sizes="32x32" href="{{ '/static/images/favicon-32x32.png' | relative_url }}">
9+
<link rel="icon" type="image/png" sizes="16x16" href="{{ '/static/images/favicon-16x16.png' | relative_url }}">
1010
<!-- Bootstrap CSS -->
1111
<link rel="stylesheet" href="https://bootswatch.com/4/litera/bootstrap.min.css">
1212
<!-- Fontawesome JS -->
1313
<script defer src="https://use.fontawesome.com/releases/v5.0.10/js/all.js" integrity="sha384-slN8GvtUJGnv6ca26v8EzVaR9DC58QEwsIk9q1QXdCU8Yu8ck/tL/5szYlBbqmS+" crossorigin="anonymous"></script>
1414

1515
<!-- Custom CSS -->
16-
<link rel="stylesheet" href="static/stylesheets/style.css">
17-
<link rel="stylesheet" href="static/stylesheets/custom-home.css">
16+
<link rel="stylesheet" href="{{ '/static/stylesheets/style.css' | relative_url }}">
17+
<link rel="stylesheet" href="{{ '/static/stylesheets/custom-home.css' | relative_url }}">
1818
</head>
1919

2020
<body class="w-100 h-100">
@@ -73,7 +73,7 @@ <h1>
7373
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
7474

7575
<!-- Workshop Status JS -->
76-
<script src="static/javascripts/workshop-status.js"></script>
76+
<script src="{{ '/static/javascripts/workshop-status.js' | relative_url }}"></script>
7777

7878
</body>
7979
</html>

static/javascripts/workshop-status.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
(function() {
55
'use strict';
66

7-
// Configuration
8-
const UPCOMING_WORKSHOPS_URL = 'data/upcoming_workshops.json';
9-
const WORKSHOP_MAPPINGS_URL = 'data/workshop_mappings.yml';
7+
// Configuration - detect base URL
8+
const baseUrl = window.location.pathname.includes('/dlab-workshops/') ? '/dlab-workshops' : '';
9+
const UPCOMING_WORKSHOPS_URL = baseUrl + '/data/upcoming_workshops.json';
10+
const WORKSHOP_MAPPINGS_URL = baseUrl + '/data/workshop_mappings.yml';
1011

1112
// Cache for performance
1213
let workshopData = null;
@@ -88,6 +89,7 @@
8889
return title.toLowerCase()
8990
.replace(/[^a-z0-9\s]/g, '')
9091
.replace(/\s+/g, ' ')
92+
.replace(/parts\s+\d+[-]\d+/g, 'parts') // Normalize "Parts 1-3" to just "parts"
9193
.trim();
9294
}
9395

0 commit comments

Comments
 (0)