How do you render a page, but with the anchor tag as well in express.js routes?
So: website.com/route#id-of-html-element
You can't. The anchor tag is not sent between client and server. Only the client deals with it. I think the only way to do this would be something like this:
res.render ('view', {anchor: 'anchor'});
in Express, then in your template put some javascript:
if anchor
script.
window.onload = window.location.hash = '#{anchor}';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With