How to change number of posts shown on homepage vs other pages?

I do not know your new modified code, neither can I find an exact use case which I have done previously, but as I already said, you should be using pre_get_posts to set your desired amount of posts on the home page.

Before I do, just a pro tip which will safe you many headaches due to debugging, use proper old school syntax, the curly bracket ({}). I do not know of code editors that support your syntax, which makes debugging a nightmare. Curly brackets are supported by all. So avoid using

if ( 'something' )
   // Do what you need to do
else
    // Do something else

and avoid using

if ( 'something' ) :
   // Do what you need to do
else :
    // Do something else
endif;

and rather use

if ( 'something' ) {
   // Do what you need to do
} else {
    // Do something else
}

To come back to the issue, you can try

add_action( 'pre_get_posts', function ( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
        $query->set( 'posts_per_page', 1 ); // Remove post if you only need page
    }
});

error code: 523