feat: add scheduled publishing with publish_at frontmatter field
Posts with a future publish_at date are hidden from the public API and feeds, same as drafts. The admin form exposes a Publish at field.
This commit is contained in:
@@ -126,4 +126,19 @@ class ServerTest < Minitest::Test
|
||||
assert_equal "*", last_response.headers["Access-Control-Allow-Origin"]
|
||||
assert_equal "GET, OPTIONS", last_response.headers["Access-Control-Allow-Methods"]
|
||||
end
|
||||
|
||||
def test_scheduled_post_is_hidden
|
||||
future = (Date.today + 30).strftime("%Y-%m-%d")
|
||||
File.write(File.join(@dir, "later.md"), <<~POST)
|
||||
+++
|
||||
title = "Later"
|
||||
publish_at = #{future}
|
||||
+++
|
||||
|
||||
Not yet.
|
||||
POST
|
||||
get "/api/volumen/posts"
|
||||
slugs = JSON.parse(last_response.body)["posts"].map { |post| post["slug"] }
|
||||
refute_includes slugs, "later"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user