Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

events.icsをイベントのページから生成するようにした #52

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ on:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
Expand All @@ -30,7 +31,7 @@ jobs:
run: pnpm run build

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: "./public"

Expand All @@ -46,7 +47,7 @@ jobs:
name: github-pages
url: https://until-tsukuba.github.io

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/deploy-pages@v1
- uses: actions/deploy-pages@v4
15 changes: 0 additions & 15 deletions src/_data/events.json

This file was deleted.

24 changes: 13 additions & 11 deletions src/ical.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//until./until-tsukuba.github.io//NONSGML v1.0//JP
X-WR-TIMEZONE:UTC
{% for event in events %}
{%- for event in collections.event %}
BEGIN:VEVENT
DTSTART;TZID=UTC;VALUE=DATE-TIME:{{ event.dtstart | date | dateToISO8601 }}
DTEND;TZID=UTC;VALUE=DATE-TIME:{{ event.dtend | date | dateToISO8601 }}
SUMMARY:{{ event.name }}
{% if event.location !== undefined %}
LOCATION:{{ event.location }}
{% endif %}
{% if event.url !== undefined %}
URL:{{ event.url }}
{% endif %}
UID:{{ event.page.fileSlug }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slugをUIDとして活用するの、多分正しいがそれで良いかは確認が必要そう

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

icalendarの規約的にマズいということですか?

Copy link
Contributor

@oageo oageo Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

icalの規格(RFC 5545)的に、UIDの重複は許されておらず、将来的に年度は異なるもののslugが同一な記事(例えば2025/ntt-tunnnel2026/ntt-tunnnel)が存在しうる状況で採用するのはちょっと怖い、という意味です
ref: https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.4.7

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

icalの規格に詳しくないのですが、数字から始まることが許容されるのであれば、UIDには年を頭に付加するなどをしても良いのではないかと思っています

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ〜〜〜なるほど、ユニークさということですね

Copy link
Member

@eniehack eniehack Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ical詳しくない2なのですが、UIDはグローバルにユニークであることが求められている?
https://icalendar.org/New-Properties-for-iCalendar-RFC-7986/5-3-uid-property.html

であるなれば、そのままurlを置いてしまってもよい気もします

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UIDに使って良い文字種がわからないのですが、記号がOKなら確かにURLが良さそう。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DTSTAMP:{{ event.page.date | date | dateToISO8601 }}
DTSTART;VALUE=DATE-TIME:{{ event.data.dtstart | date | dateToISO8601 }}
DTEND;VALUE=DATE-TIME:{{ event.data.dtend | date | dateToISO8601 }}
SUMMARY:{{ event.data.title }}
{% if event.data.location !== undefined -%}
LOCATION:{{ event.data.location }}
{%- endif %}
{% if event.url !== undefined -%}
URL:{{ "https://until-tsukuba.github.io" + event.url }}
{% endif -%}
END:VEVENT
{% endfor %}
{%- endfor %}
END:VCALENDAR