Use the default liquid object to show the titles, you can check more about this here page_title
Also, you can check the reference code from theme.liquid file of the default dawn theme from Shopify itself Dawn theme