Getting post URL within custom content template

You need to switch get_permalink to the_permalink or echo esc_url(get_permalink).

get_permalink

the_permalink