It’s not black hat SEO for sure and if you have the technical knowledge to do that then go ahead. Making the job of the search engine bots easier, is always a good think. There are a lot of educational resources out there to read and watch that will help https://daltonmpnib.techionblog.com/28003265/note-dettagliate-su-ottimizzazione-seo-off-page