the_permalink on the homepage vs posts for sharing links

This code displays takes get_permalink() on a single page and get_home_url() on the homepage. If a link is found the Share-Link will be displayed.

So the Link wouldn’t be displayed right now on a category-page for example.

<?php
    if( is_home() ){
        $link = urlencode( get_home_url() );
        $title = urlencode( get_bloginfo( 'title' ) );
    }elseif( is_single() || is_page() ){
        $link = urlencode( get_permalink() );
        $title = urlencode( get_the_title() );
    }

    if( isset( $link ) ):
?>
<a href="http://www.facebook.com/sharer.php?u=<?php 
    echo $link;?>&amp;t=<?php echo $title; 
?>" target="_blank">Share this on Facebook</a>
<?php
    endif;
?>

Info: