Do you mean only on the first page?
If so, you need that if statement:
if ( !is_paged() ) {
//do stuff only on 1 page
}
If it’s not working probably you should create a new variable that will store your home page URL and make another if statement like, if URL is https://yourdomain.com/
then do stuff.