You can get the Discourse topic URL for a post with
get_post_meta( $post_id, 'discourse_permalink', true );
Something like this will work inside the loop (for example, in single.php
)
<?php
$topic_url = get_post_meta( get_the_ID(), 'discourse_permalink', true );
$comments_number = get_comments_number();
switch ( $comments_number ) {
case 0:
$comment_link_text = 'Start the Conversation';
break;
case 1:
$comment_link_text = '1 Comment';
break;
default:
$comment_link_text = "$comments_number Comments";
}
?>
<a href="<?php echo esc_url( $topic_url ); ?>"><?php echo esc_html( $comment_link_text ); ?></a>