hCalendar Markup for Event Scheduling
Structuring event information on the web requires a balance between human readability and machine interpretability. hCalendar is a microformat that allows developers to embed calendar data directly into HTML, enabling search engines and applications to parse event details automatically.
Implementing hCalendar with HTML
To implement hCalendar, developers use standard HTML <span> elements assigned specific CSS classes. These classes act as markers that tell a machine which piece of text represents a specific attribute of an event.
The primary container for an event is the vevent class. Within this container, several supporting classes are used to define the event's specifics:
- summary: The title or name of the event.
- dtstart: The starting date and time.
- dtend: The ending date and time.
- location: The physical or virtual venue.
- url: A link to more detailed information about the event.
[ไม่มีภาพประกอบ]
Ensuring Machine Readability with ISO8601
While humans prefer dates written as "October 12th, 2023," machines require a standardized format to avoid ambiguity. hCalendar utilizes the <abbr> (abbreviation) element to store dates in the ISO8601 format.
ISO8601 is an international standard for the representation of dates and times, ensuring that software can accurately calculate durations and synchronize schedules regardless of the user's local date format.
Key Facts
- hCalendar uses HTML
<span>elements and specific CSS classes for data marking. - The
veventclass serves as the main wrapper for event data. - Machine-readable dates are stored within
<abbr>tags. - The ISO8601 standard is used for date-time formatting to ensure global compatibility.
| Class Name | Purpose | Example Content |
|---|---|---|
| vevent | Event Container | The entire event block |
| summary | Event Title | Annual Tech Conference |
| dtstart | Start Date/Time | 2023-10-12T09:00 |
| dtend | End Date/Time | 2023-10-12T17:00 |
| location | Venue | Convention Center, NY |
| url | Reference Link | https://example.com/event |
Frequently Asked Questions
What is hCalendar?
hCalendar is a microformat used to mark up calendar and scheduling information in HTML so that it can be easily read by both humans and software.
Which HTML element is used for the machine-readable date?
The <abbr> element is used to contain the machine-readable date-time format.
What is ISO8601?
ISO8601 is an international standard for formatting dates and times, which prevents confusion between different regional date conventions.
What is the purpose of the vevent class?
The vevent class identifies the start of a calendar event object, grouping all related details like the summary, location, and time together.