putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
149 stars 36 forks source link

Blitz widget for entry sidebar #651

Closed justenh closed 5 months ago

justenh commented 5 months ago

Feature Request

We are using Blitz and the Git Deployer for an SSG setup and one thing that are admins have requested is more readily available insights into when a particular entry was last cached/deployed. It would be really helpful if the Entry Sidebar could have a small widget showing some of the info currently available in the Utilities -> Blitz Diagnostic view for any particular entry.

Thanks for the amazing plugin!

Plugin Version

No response

bencroker commented 5 months ago

What, for example, would be displayed in an entry’s sidebar? Keep in mind that entries are not cached, it is pages that are cached, which can contain reference entries.

justenh commented 5 months ago

Ideally, if the entry being viewed has a URI matching a known Blitz cache, that cache's information would be displayed. Specifically we would like to see the date the URI was cached, or if it is currently expired. Even though it's been suggested in a similar feature request, I would like to avoid adding buttons for manipulating the related cache directly from the entry.

bencroker commented 5 months ago

I’m still sceptical of the value of this. An entry can have its own URI (but must not), and just as likely is that it is output and cached in multiple other URIs. What value does displaying that cached date of only one of these URIs provide, and can you show me how you imagine it appearing?

justenh commented 5 months ago

@bencroker In our case, it would be very helpful for our non technical admins. We've had several situations where URIs in Blitz cache have been a bit of a black box. Non technical admins, who would not feel comfortable using the Blitz Diagnostics utility, would like to know if/when their content was last generated, deployed, refreshed, etc. Even for technical admins, this would make the conversation easier for trouble shooting with our content team. For us, a large number of URIs do exist as entries.

A content admin could put in a ticket saying "My new entry Super Awesome Entry was saved, but Blitz cache widget doesn't have any information on generation, or deployment.". This would trigger someone like myself to go in and start checking to make sure that section was developed with the appropriate Blitz tags in the .twig file etc.

Additionally, it would be extremely helpful if they could see that the entries URI currently exists in a queue job for Blitz generation/deployment. This way they know that their changes might not have been pushed, yet, but will be. Or that they might be editing something that is going to be deployed as part of a larger batch.

Maybe this is something that could be configured on a section-by-section, element-by-element, basis?

bencroker commented 5 months ago

Non technical admins, who would not feel comfortable using the Blitz Diagnostics utility, would like to know if/when their content was last generated, deployed, refreshed, etc.

Blitz doesn’t currently keep track of any of these things, so the data’s not there. Really, the only data the plugin stores about cached URIs is whether they are tracked (not necessarily cached) and, if they are, their expiry date (if they have one). Beyond that and what is available in the Blitz Diagnostics utility, the data you’d like to display is simply not available.

One option would be to build a plugin specific for your use-case, that tracks these data points in its own database table and displays it in the sidebar of the entry edit page. If that’s of interest then I’d be happy to explore building this for you, or helping out where I can. Please contact me directly about it.

bencroker commented 2 months ago

@justenh FYI I’ve opened a PR to address this at https://github.com/putyourlightson/craft-blitz/pull/690, feel free to take a look and offer any suggestions.