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

Atom 1.0 support #1089

Closed
wants to merge 11 commits into from
Closed

Atom 1.0 support #1089

wants to merge 11 commits into from

Conversation

ChillyCider
Copy link

This PR resolves issue #1081 by adding Atom 1.0 feed support.

In order to generate valid Atom feeds, I had to add 2 new frontmatter settings, updated_date and authors:

---
# ...
updated_date: 2022-11-02 03:14:00 +0100
authors:
    - Charlie Murphy
---

The Atom spec demands the existence of an "updated" date, while the "published" date is optional -- this seems backwards to me but I won't argue with the spec 😄 . Since published_date is more common in cobalt, I've made Atom use it as a fallback. That way, most existing cobalt blogs should be fine.

However, Atom also demands the existence of "authors". For single-author blogs, you may be well-served to stick the author into your _cobalt.yml's "default" section.

Copy link
Member

@epage epage left a comment

Choose a reason for hiding this comment

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

This includes some parts that are new features outside of atomic support. We should make sure we are on the same page for the requirements in an issue and then do a PR for them.

For what atom support doesn't directly depend on, let's not have atom block on it but then have another PR to take advantage of it

@@ -21,12 +21,16 @@ pub struct Frontmatter {
#[serde(skip_serializing_if = "Option::is_none")]
pub categories: Option<Vec<liquid_core::model::KString>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub authors: Option<Vec<liquid_core::model::KString>>,
Copy link
Member

Choose a reason for hiding this comment

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

Could you split this out into its own Issue / PR?

pub tags: Option<Vec<liquid_core::model::KString>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub excerpt_separator: Option<liquid_core::model::KString>,
#[serde(skip_serializing_if = "Option::is_none")]
pub published_date: Option<DateTime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub updated_date: Option<DateTime>,
Copy link
Member

Choose a reason for hiding this comment

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

Could you split this out into its own issue / PR?

#197 exists but that is more about automatically inferring it

Comment on lines +564 to +568
// create target directories if any exist
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)
.with_context(|_| failure::format_err!("Could not create {}", parent.display()))?;
}
Copy link
Member

Choose a reason for hiding this comment

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

The other ones don't have this. Is there a reason to do it to one vs all?

Comment on lines +13 to +14
use vimwiki::vendor::chrono::DateTime;
use vimwiki::vendor::chrono::Utc;
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't be relying on vimwiki like this. If we need chrono, we should use chrono.

@@ -0,0 +1,16 @@
```console
$ cobalt -v build --destination _dest
Copy link
Member

Choose a reason for hiding this comment

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

We need .out directories made so we can snapshot the filesystem.

TRYCMD=dump will dump to a directory. You can then copy the output over into the test

@ChillyCider
Copy link
Author

@epage Hey thanks for reviewing my PR. I actually ended up using Jekyll to fix my issue, and thereby lost the driving need to add this to Cobalt. 😆
I'll close this for now, good luck! I have high hopes for Cobalt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants