Magento 2 Add Anchor link to Success or Error Message.

You can add anchor tag link in success message, an error message or any notification message in Magento 2 by addSuccessMessage( ), addErrorMessage( ) and addNoticeMessage( ) respectively.

Let’s add a link to the Shopping cart of a product successfully added to the cart.

You can add your message under the addSuccessMessage( ) function. If you want to add custom link in error message you need to use addErrorMessage( ) function to display link.

link in custom message
add custom link in a success message

Always Use,
addSuccessMessage() instead of addSuccess()
addErrorMessage() instead of addError()
addNoticeMessage() instead of addNotice()

addSuccess(), addError(), addNotice() methods are deprecated.