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://seoonpagewordpress25813.ageeksblog.com/27434614/la-guida-definitiva-a-seo-off-page-pdf