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

Post meta blocks inside sentence #25448

Open
iamtakashi opened this issue Sep 18, 2020 · 6 comments
Open

Post meta blocks inside sentence #25448

iamtakashi opened this issue Sep 18, 2020 · 6 comments
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Needs Design Feedback Needs general design feedback. New Block Suggestion for a new block [Type] Enhancement A suggestion for improvement.

Comments

@iamtakashi
Copy link

It'd be great if we could display post meta blocks (e.g. post date, post categories, etc.) in a sentence

image

There are tons of different variations, but I'm sure you get the idea :)

Related: #24953

@carlomanf
Copy link

#21932 might be related

@karmatosed karmatosed added the Needs Design Feedback Needs general design feedback. label Sep 23, 2020
@iamtakashi iamtakashi mentioned this issue Sep 24, 2020
8 tasks
@mtias
Copy link
Member

mtias commented Sep 25, 2020

I think a fine line to thread here is not creating a pseudo-templating language by using fragments of dynamic data and user editable text around it. The degree of customization you might want to do is quite infinite. It'd make sense to offer more tailored blocks for some common elements — for example Byline as a separate block from Author and Category. Byline could have a few options, but it should still be making default decisions. A custom block could be provided for more novel displays. cc @mcsf for thoughts

@mtias mtias added the New Block Suggestion for a new block label Sep 25, 2020
@mcsf
Copy link
Contributor

mcsf commented Sep 28, 2020

not creating a pseudo-templating language by using fragments of dynamic data

Agreed, this is something to avoid.

It's already confusing enough that @wordpress/date has to map PHP's DateTime format to moment.js, and that (for now) JS has no robust enough time format that we can use, and that JS doesn't implement the well established strftime format (that even PHP does). In short, talking consistently across environments is difficult enough without introducing DSLs.

Byline could have a few options, but it should still be making default decisions.

Yeah, I think this is the way to go. In short, a Byline block providing a few choices, e.g.

  • Posted by author on date
  • Posted in category by author

Beyond these fixed options, I don't object a priori to people experimenting with an advanced control to override Byline's string, but it would need to solve a lot of upfront challenges (safe interpolation, simple implementation, and support for i18n). That last one, solving i18n, is really the hardest part. I really don't want to see __( 'Posted' ) + sprintf( __(' by %' ), author ) + sprintf( __( 'on %' ), date ). 😅

@mtias
Copy link
Member

mtias commented Sep 28, 2020

Makes me think if — for now — we should proxy date generation to the server through a lean API endpoint.

@mcsf
Copy link
Contributor

mcsf commented Sep 29, 2020

Makes me think if — for now — we should proxy date generation to the server through a lean API endpoint.

I wondered similarly, but we already use wp.date.format in a bunch of places successfully, even if it's strange that we have to map between formats, so I don't know how much value that endpoint would provide.

@mtias
Copy link
Member

mtias commented Oct 1, 2020

We might be able to remove some code and dependencies.

@mtias mtias added the [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. label Jul 27, 2021
@ellatrix ellatrix added the [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable label Aug 15, 2023
@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Needs Design Feedback Needs general design feedback. New Block Suggestion for a new block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

7 participants