I’d say this approach is fine
Jekyll can do this for you by setting in the config.
permalink: pretty
This is useful in other situations like if you have
my-dir/
my-dir/abc.html
my-dir/def.html
And this will use the pretty format for you I links, so you can switch the config value in one place and not have to worry about the rest of the site
href="{{ my_page.url }}"
"/my-dir/" <!-- if format is pretty -->
"/my-dir.html" <!-- if you left the default format -->
As it avoids this default where the directory appears to be a standalone page and also a dir which feels weird.
my-dir.html
my-dir/abc.html
my-dir/def.html
And also if you edit the page of /my-dir/abc.html
in your browser to be /my-dir/
, that will appear as a 404 and is bad experience for the user.