-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
Description
There's a potential inconsistency in how time zones are handled in permalink date formatting. The current implementation uses the local time zone when formatting dates in permalinks:
date = p.PostDate().In(time.Local)This means that the same content will generate different permalinks depending on the local time zone of the machine running the code. For example, a post with a UTC date of February 3 will have a permalink with "02/03" in UTC time zones, but "02/04" in UTC+9 (Japan) time zones.
Investigation Needed
- Determine how Jekyll handles time zones in permalinks. Does it use UTC consistently, or does it also use the local time zone?
- Decide whether gojekyll should match Jekyll's behavior or adopt a more consistent approach (e.g., always using UTC).
Current Workaround
The tests have been updated to expect dates in the local time zone, but this is just a temporary fix. The real solution depends on what behavior we want to standardize on.
Potential Solutions
- If Jekyll uses UTC: Modify
permalinks.goto usedate = p.PostDate().UTC()instead ofdate = p.PostDate().In(time.Local) - If Jekyll uses local time: Keep the current implementation but document this behavior clearly
- Make the time zone configurable in the site configuration
Related Files
pages/permalinks.go- Contains the current implementationpages/permalinks_test.go- Contains tests that were updated to accommodate local time zone