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

Pre-publish checklist #277

Closed
thetwopct opened this issue Aug 27, 2020 · 11 comments
Closed

Pre-publish checklist #277

thetwopct opened this issue Aug 27, 2020 · 11 comments
Assignees
Labels
idea idea for the future

Comments

@thetwopct
Copy link
Collaborator

I've implemented the Publication Checklist plugin, written some pre-publication rules and added them to the LF MU plugin.

Rules load after plugins and customisation won't load if the plugin isn't present.

The checklist can be added to/edited in checklist.php

To get us started, I've set up:

  • Posts - check image is 1200x630 size (minimum recommended size for social share)
  • Webinar - check for topics applied to post
  • Case Study - check video is present in body

20200827144119-Add New Post ‹ Cloud Native Computing Foundation — WordPress

The checklist displays before publication, or can be accessed using the top nav to open in the sidebar.

The checklist only applies to new posts, but it does give the status of the checklist regardless of its post status, so this could be useful for checking that all posts comply with SEO/content rules.

The checklist can be bypassed by the Editor after confirmation they understand they have not met requirements.

20200827144717-Add New Post ‹ Cloud Native Computing Foundation — WordPress

@thetwopct thetwopct self-assigned this Aug 27, 2020
@cjyabraham
Copy link
Collaborator

cjyabraham commented Aug 28, 2020

I think this is cool but think we should hold off adding it until it's clear what the pain points are for our editors. It may turn out to be unnecessary and not worth the extra code and UI distraction. I also think it could be misleading to remind people about, say, webinar topics, but then leave out other categories. It could imply that the other categories aren't mandatory when, in fact, they are.

@thetwopct
Copy link
Collaborator Author

thetwopct commented Aug 28, 2020

I have deactivated the plugin. Will leave the additional code in LF MU for now.

@cjyabraham
Copy link
Collaborator

When I went to upgrade LFPH to WP 5.5.1 this code started throwing an error:

Fatal error: Uncaught Error: Call to undefined function is_plugin_active() in /app/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/class-lf-mu-admin.php:400 Stack trace: #0 /app/web/wp/wp-includes/class-wp-hook.php(287): Lf_Mu_Admin->pre_publish_checklist('') #1 /app/web/wp/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #2 /app/web/wp/wp-includes/plugin.php(478): WP_Hook->do_action(Array) #3 /app/web/wp/wp-settings.php(409): do_action('plugins_loaded') #4 /app/web/wp-config.php(216): require_once('/app/web/wp/wp-...') #5 /app/web/wp/wp-load.php(42): require_once('/app/web/wp-con...') #6 /app/web/wp/wp-blog-header.php(13): require_once('/app/web/wp/wp-...') #7 /app/web/index.php(6): require('/app/web/wp/wp-...') #8 {main} thrown in /app/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/class-lf-mu-admin.php on line 400

I don't know why it doesn't fail as well on CNCF, however, this seems to be the workaround.

For now, I've just commented out the pre_publish_checklist hook.

@cjyabraham
Copy link
Collaborator

Can we turn off the suggestion to add tags to posts?
Screen Shot 2020-09-10 at 11 24 44 AM

@thetwopct
Copy link
Collaborator Author

That isn’t part of the pre-publish checklist module I’ve added, that seems to be part of WordPress.

@thetwopct
Copy link
Collaborator Author

Just adding this here for my notes and I’ll try to work out how to remove that suggestion
https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/post-publish-panel/maybe-tags-panel.js

@cjyabraham
Copy link
Collaborator

cjyabraham commented Sep 13, 2020

In prep for deploying this, I tweaked the checklists and also disabled the webinar one because I don’t think the team will need to be reminded again about topics (if I’m wrong, we’ll be able to see and then we can activate it) and, as I say above, it would seem odd to me to remind them about topics but not about other required metadata.

But I think I've found a more serious problem with this solution. The checklists only update when you save to the back-end, so often the checklists reflect an inaccurate state of the post. This is especially misleading in Gutenberg which is known for showing updates live. The issue is best described here and I've also made a video.

To avoid creating confusing when we're trying to reduce it, I think we should wait for that to be fixed in the plugin or consider an alternative implementation.

@thetwopct
Copy link
Collaborator Author

thetwopct commented Sep 17, 2020

I see your point although I don't think its serious. Other plugins (Yoast SEO immediately springs to mind) work exactly the same and require saving a post draft first for the SEO checks to start and give feedback. All content plugins worked like this pre-Gutenberg. Only with Gutenberg are you expecting checks to happen every time a user presses a key or in time with the WP heartbeat. Running an analysis over the content after each key press has potential performance implications in itself.

I would be happy with what we have, and I think it has a benefit to editors regardless of real time feedback. I don't think it causes confusion, it's just slightly different and requires some patience to get a result. But as you are not happy, I will remove pp-c from the site and MU plugin, and explore how to do this via React.

thetwopct added a commit to cncf/wp-mu-plugins that referenced this issue Sep 17, 2020
@cjyabraham cjyabraham added the idea idea for the future label Sep 18, 2020
@thetwopct
Copy link
Collaborator Author

Digging in to this today and got it working using JS.

20200924000312-Edit Post ‹ Cloud Native Computing Foundation — WordPress

Using lockPostSaving() function, it's possible to prevent posts being submitted if conditions are not met. I haven't found an override for this yet so, for instance, if an editor wanted to submit a blog post regardless of the presence of a featured image, and we had made that as a requirement, there would not be a way for them to bypass the requirement (unlike the Human Made plugin we tested).

The JS version of P-PC works much the same as the PHP version, and requires the editor to save the post as a draft or preview the post to start some of the checks (like Featured Image). I am exploring whether it's possible to hook in to the media uploader to trigger the checks via JS.

I did fine one big issue - in that if a post is published, but then edited, the pre-publish checklists no longer show, but the rules still apply. I've been working around this to add a sidebar for the P-PC (like the last plugin) to inform the editor, or I may be able to detect if post has already been published and therefore not apply the rules.

It would also be useful to define the rules you think we need so I can focus on developing those first.

For Posts (Blog Category Only)

Recommended rules:
Add featured image
More than 500 words
No H1 tags
Featured image at least 1200x630 (or some feedback around that)

Required rules:
Featured image bigger than 540x285

Any others?

@cjyabraham
Copy link
Collaborator

I don't think we should have any required rules that stop a person from publishing. You could add a rule to make sure one and only one category is chosen for a post. The other rules you have there look fine.

For webinars, you could add a rule to make sure a date is set. There have been a couple instances now where there is no date set.

@cjyabraham
Copy link
Collaborator

Deploying work so far and closing this in favor of new issue for later work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea idea for the future
Projects
Status: Done
Development

No branches or pull requests

2 participants