There are many ways to achieve this, but none are trivial.
Make a server-side rendered block, and use $wp_query->current_post +1;
to get the index of the post inside the loop.
Using counter()
, see :
How do I achieve automatic numbering for headings using css
The worst way because you can't see the result in Gutenberg editor, but you can filter the core/post-template
block with the render_block
filter and replace the ul
html tag with ol
The better solution is programming a custom block doing the same as the core/post-template with your addition. You can find the source here: https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-template