Skip to content

Commit

Permalink
Add nice system for adding hws and lectures
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdeepsb committed Sep 4, 2024
1 parent 7bc7b1c commit b7b3c1b
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 26 deletions.
3 changes: 1 addition & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ collections:
schedules:
announcements:
homeworks:
# output: true
# permalink: /homeworks/:name/
lectures:

# Define a collection named "resource", its documents reside in the "_resource" directory
# resource:
Expand Down
4 changes: 2 additions & 2 deletions _homeworks/hw0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
title: "Homework 0"
release_date: 2024-09-05
due_date: 2024-09-10
pdf: "/assets/homeworks/test.pdf"
gradescope_link: "https://canvas.mit.edu/courses/28217/external_tools/369"
# pdf: "/assets/homeworks/test.pdf"
# gradescope_link: "https://canvas.mit.edu/courses/28217/external_tools/369"
---
8 changes: 4 additions & 4 deletions _homeworks/hw1.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Homework 1"
release_date: 2024-09-11
due_date: 2024-09-17
pdf: "/assets/homeworks/not-yet-released.pdf"
gradescope_link: "https://gradescope.com/courses/your_course/hw1"
release_date: 2024-09-05
due_date: 2024-09-10
# pdf: "/assets/homeworks/test.pdf"
# gradescope_link: "https://canvas.mit.edu/courses/28217/external_tools/369"
---
6 changes: 6 additions & 0 deletions _lectures/lecture1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "Lecture 1"
id: 1
# notes: "/assets/lectures/test.pdf"
# slides: "/assets/lectures/test.pdf"
---
6 changes: 6 additions & 0 deletions _lectures/lecture2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "Lecture 2"
id: 2
# notes: "/assets/lectures/test.pdf"
# slides: "/assets/lectures/test.pdf"
---
Binary file added assets/lectures/test.pdf
Binary file not shown.
23 changes: 11 additions & 12 deletions main/Lectures.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
---
# layout: default
title: "Lectures"
nav_order: 6
# permalink: /homeworks/
nav_order: 2
---

# Lectures

TODO: create lecture modules and add content here
Find notes from lectures below.

{% assign sorted_homeworks = site.homeworks | sort: 'release_date' | reverse %}
{% assign limit_value = 1 %} <!-- Set this to the number of lectures to display-->
{% assign sorted_lectures = site.lectures | sort: 'id' | reverse %}
{% assign total_items = sorted_lectures | size %}
{% assign start_index = total_items | minus: limit_value %}
{% assign filtered_lectures = sorted_lectures | slice: start_index, limit_value %}

{% for hw in sorted_homeworks %}
## {{ hw.title }}

- **Release Date:** {{ hw.release_date | date: "%B %d, %Y" }}
- **Due Date:** {{ hw.due_date | date: "%B %d, %Y" }}
- **[Download PDF]({{ hw.pdf }})**
- **[Submit to Gradescope]({{ hw.gradescope_link }})**
{% for lecture in filtered_lectures %}
## {{ lecture.title }}
- {% if lecture.notes %} **[Notes]({{ lecture.notes }})** {% else %} **Notes:** *To be released* {% endif %}
- {% if lecture.slides %} **[Slides]({{ lecture.slides }})** {% else %} **Slides:** *To be released* {% endif %}

{% endfor %}
14 changes: 8 additions & 6 deletions main/homeworks.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
---
# layout: default
title: "Homeworks"
nav_order: 6
# permalink: /homeworks/
nav_order: 1
---

# Homeworks

{% assign limit_value = 1 %} <!-- Set this to the number of hws to display-->
{% assign sorted_homeworks = site.homeworks | sort: 'release_date' | reverse %}
{% assign total_items = sorted_homeworks | size %}
{% assign start_index = total_items | minus: limit_value %}
{% assign filtered_homeworks = sorted_homeworks | slice: start_index, limit_value %}

{% for hw in sorted_homeworks %}
{% for hw in filtered_homeworks %}
## {{ hw.title }}

- **Release Date:** {{ hw.release_date | date: "%B %d, %Y" }}
- **Due Date:** {{ hw.due_date | date: "%B %d, %Y" }}
- **[Download PDF]({{ hw.pdf }})**
- **[Submit to Gradescope]({{ hw.gradescope_link }})**
- {% if hw.pdf %} **[PDF]({{ hw.pdf }})** {% else %} **PDF:** *To be released* {% endif %}
- {% if hw.gradescope_link %} **[Submit to Gradescope]({{ hw.gradescope_link }})** {% else %} **Submit to Gradescope:** *To be released* {% endif %}

{% endfor %}

0 comments on commit b7b3c1b

Please sign in to comment.