getzola/zola

Some valid yaml dates are treated as invalid

Open

#2 071 ouverte le 15 janv. 2023

Voir sur GitHub
 (15 commentaires) (0 réactions) (0 assignés)Rust (1 046 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (15 349 stars)
Métriques de merge PR
 (Merge moyen 48j 17h) (4 PRs mergées en 30 j)

Description

Bug Report

Environment

Zola version: zola 0.16.1

Expected Behavior

This front-matter should parse successfully (see https://www.yamllint.com/ for an example of another tool that can parse it; this was originally migrated from a Jekyll site which can also parse it):

---
layout:	post
title:	"Hosting an SSH Server"
date:	"2017-12-27 20:46:24 -0500"
excerpt: I decided one day that I really wanted a remote server.
audience: tech-savvy
---

Current Behavior

PS C:\Users\jyn\src\third-website> zola serve                     
Building site...
Error: Failed to serve the site
Error: Error when parsing front matter of section `\\?\C:\Users\jyn\src\third-website\content\blog\2017-12-27-Hosting-an-SSH-Server.md`
Error: Reason: YAML deserialize error: Error("failed to parse datetime", line: 2, column: 1)

I think the problem is that dates are unconditionally parsed as toml dates, which is not correct: https://github.com/getzola/zola/blob/39bfbcd0199340ce5de4d0b951a2050cc9fc239e/components/content/src/front_matter/page.rs#L31-L33

Step to reproduce

Add the given frontmatter to any .md file in content/blogs.

Guide contributeur