virajchitnis / virajchitnis.com

www.virajchitnis.com
MIT License
0 stars 0 forks source link

Routing via events #21

Closed virajchitnis closed 7 years ago

virajchitnis commented 7 years ago

Change all menu bar hrefs to click methods. When clicked, they will each trigger an event. The App will be listening to these events, and when it hears it, it will switch the dom to the appropriate page and update the pathname to correspond. Server side will remain as it is.

virajchitnis commented 7 years ago

Also, try to avoid generating a separate HTML file for each page. Try to use the same file, but change the page title using some node.js middleware/code.

virajchitnis commented 7 years ago

Don't forget to update the page title to match the current page. document.title = 'blah blah';

virajchitnis commented 7 years ago

https://www.npmjs.com/package/html-webpack-pug-plugin

virajchitnis commented 7 years ago

https://expressjs.com/en/guide/using-template-engines.html

virajchitnis commented 7 years ago

Output the HTML as pug/jade and then render via expressJS. That will allow me to use the same HTML file for all pages. Have the ExpressJS template engine set the title of the page.