Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Support blogging-like functionality #1197

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

Closed
fgregg opened this issue Apr 3, 2024 · 5 comments
Closed

Support blogging-like functionality #1197

fgregg opened this issue Apr 3, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@fgregg
Copy link

fgregg commented Apr 3, 2024

I love where this project is going!

I wonder if y'all would be open to considering adding support for jekyll's blogging pattern.

Namely, that if your markdown file is in a _posts directory, and if its titled like YEAR-MONTH-DAY-title.MARKUP then bloggy things happen:

For jekyll, this means that,

  1. The built html is put into a directory structure to get a nice url that looks like DOMAIN/YEAR/MONTH/DAY/title.html
  2. the page's date is made available to the layout template, so that the published date can be automatically inserted
  3. the site's posts are made available as an object you could interact with sites.posts i.e. to show the latest blog post on the front page jekyll lets you do something like this in an index.md.
---
layout: default
title: My Cool Blog
---

<h1>{{ site.posts.first.title }}</h1>
<p class="text-muted">{{ site.posts.first.date | date: '%B %d, %Y' }} | <a href="{{ site.posts.first.url }}">Permalink</a></p>

{{ site.posts.first.content }}
  1. jekyll does other things as well, but those would be the core of it.

I know that blogs are not your first target use case, but I think it could be a great place to go!

I'd be happy to contribute to this.

@fgregg fgregg added the enhancement New feature or request label Apr 3, 2024
@Fil
Copy link
Contributor

Fil commented Apr 3, 2024

bloggy things happen? :)

@fgregg
Copy link
Author

fgregg commented Apr 3, 2024

@Fil, sorry for not being more concrete. I put some details in it.

@Fil
Copy link
Contributor

Fil commented Apr 3, 2024

Interesting.

I don't know how better it is to write 2024-04-01-april-fool.md than having files in folders such as 2024/04/01-april-fool.md. It's probably convenient for some, but is the gain worth the cost, that is, losing the univocal mapping between file and url, and making relative links even more of a headache? Conversely, if you want a flat folder, can't you live with flat urls?

The "page's date is made available to the layout template" is related to #1036. I do want to have meta data (dates, authors, tags…) available to the page and to server-side rendering (SSR, #413).

Inferring a date from a file name seems like a minor affordance; it could be an application of a hook for inferring the page's meta data from front matter & file contents (it's already the case with the title, which can come from either front matter or from the first H1).

For page templates there was a previous attempt (in #253) with discussions and suggestions that I think are still relevant.

It would be interesting to be able to show a (structured, formatted…) list of all pages on a given page, maybe also through SSR — the SSR function could itself have access to the configuration, or even read all the contents on disk (like minisearch does).

@Fil
Copy link
Contributor

Fil commented Apr 3, 2024

I think we should move this to a discussion, and create more actionable feature requests.

@fgregg
Copy link
Author

fgregg commented Apr 3, 2024

great idea, closing this in favor of https://github.com/observablehq/framework/discussions/1198

@fgregg fgregg closed this as completed Apr 3, 2024
@Fil Fil changed the title support for jekyll-like blog patterns Support blogging-like functionality Apr 3, 2024
@observablehq observablehq locked and limited conversation to collaborators Apr 3, 2024
@Fil Fil converted this issue into discussion #1199 Apr 3, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants