-
Notifications
You must be signed in to change notification settings - Fork 206
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
Exploring blocks for displaying coauthors #932
Comments
Hello Doug! Thank you for your contributions in this issue. There are a lot of great ideas here. You've identified some valuable missing features (like block support) for the plugin that we'd be happy to have. We've looked over your PR changes and would be happy to support you in getting these merged into the main plugin. We appreciate the care and time you've put into your changes and design questions. Design questions
A solid yes for all of these!
After reviewing the code, I have some ideas on how I'd approach the limitations of the current sidebar-focused REST API. Please let me know what you think!
I experimented with a regular I think adding a new author data REST endpoint for block data specifically would work here. This should be limited to users assigned to a specific post. Co-authors on a post should be able to query for other author information for block rendering, but only for the posts that they're assigned. The API can provide author data necessary to render blocks without trying to shoehorn data into the more restrictive sidebar API. Ideally we'd use the same code in REST responses that we use for dynamic block rendering to pull relevant author information.
Good idea! A separate REST endpoint could include this and any other information you need to render blocks.
The However, if we use a separate REST endpoint + store as pitched above this fix may not be necessary. With a new store we could potentially subscribe to the existing sidebar updates and use this to auto-update co-author block data without needing to alter the sidebar behavior.
The Hopefully those can help address your questions. These answers are my personal opinion, so if you have different ideas or pushback, please let us know. Other questionsI encountered a couple of other questions testing the PR:
Thank you! |
Hi @alecgeatches thank you for all of this feedback. I will follow up as soon as I can with an implementation plan for your review. I'd like to address the
Do you have any guidance or documentation on how to do that? I have tried multiple times and never succeeded.
It shouldn't be inserted outside of a query or wrapping block context. It should be updated to be restricted to those contexts, with the possible addition of author archive templates. |
"scripts": {
"build": "wp-scripts build --webpack-src-dir=./blocks",
// ...
} This dumps the built blocks into a different
Makes sense to me! |
Thanks @alecgeatches
That change in the build folder was part of what I considered unsuccessful last time I tried this. The distributable block.json and scripts are no longer colocated with the PHP for calling Do these two issues also occur for you? I am reasonably sure I'm running the latest and the block.json in the build folder for each block includes nonexistent CSS files: |
That's annoying for the organization, I agree. I imagine most people just deal with it.
That's definitely weird, and I'm seeing the same behavior. I think it may have to do with the source layout, as What do you think about stringing together some build commands instead? This setup seems to work with the existing build structure: "scripts": {
"build": "npm run build:plugin && npm run build:block-coauthors && npm run build:block-coauthor-display-name",
"build:plugin": "wp-scripts build",
"build:block-coauthors": "wp-scripts build --webpack-src-dir=blocks/coauthors/src/ --output-path=blocks/coauthors/build",
"build:block-coauthor-display-name": "wp-scripts build --webpack-src-dir=blocks/coauthor-display-name/src/ --output-path=blocks/coauthor-display-name/build", I'm more interested in the convenience of a single |
@alecgeatches That makes sense to me. I may investigate more to see if there are ways to simplify, but we'll get to a single build command somehow. Can we discuss workflow? I imagined I would:
Would you be able to provide feedback on those issues and help decide which should apply to the v1 milestone? I expect I'll also ask for reviews on the pull requests. Does this work or is the an alternative strategy that's more appropriate? |
@douglas-johnson Sounds great! I'm sure there's smarter way to shorten or combine those steps.
The downside with this approach is that it would move the conversation and code discussion from this plugin's repository to your fork. It would be great if we can find a workflow that will keep more of that in this repo. Would this work for you?
|
Sure, I can make that work. I'll close this issue and start a new tracking issue. |
I am interested in displaying coauthor data in block editor and full site editing contexts.
I started a branch on a fork where I put together two blocks for this purpose. Here is a link to compare it to the current master version: master...thoughtis:Co-Authors-Plus:block-exploration
I am interested in feedback from both users and maintainers. Depending on the feedback I am happy to either submit a pull request, or keep this as a separate project. Thanks for taking a look.
What it does
coauthors
block which works like the Post Template block.coauthor-display-name
block.Example
Screenshot of the editor where I'm outputting the display name of the authors in both the current post and a query loop. The stored and rendered versions of this post content are included at the end of the issue.
Features I'd like to add
Questions about potentially incorporating this into Co-Authors Plus
What is the ideal way to fetch the author data in the block editor?
/coauthors/v1/authors/:post-id
for this version.profile
value to the author taxonomy terms. https://github.com/thoughtis/cata-co-authors-plus/blob/0.6.1/includes/api/class-api.phpExamples continued from above
The stored content:
The rendered content:
The text was updated successfully, but these errors were encountered: