Secure Pages Best Practice

Not sure about the best practices, but I have a few custom login-sensitive pages which simply display a message if user is not logged and is trying to view the page directly:

$logged_in = is_user_logged_in();

if($logged_in) {
?>
<article id="post">
        <?php the_content(); ?>
</article>
<?php
} else {
    _e('You are not logged in. Please ', 'abc');
    echo '<a href="' . site_url( 'login' ) . '">'. __('log in','abc') .'</a> ' . __('or','abc') . ' ';
    echo '<a href="' . site_url( 'register' ) . '">'. __('register','abc') .'</a>.';
}

Note: both the login and register pages are custom pages as well.