How to include CDN dependencies only on certain pages?

Hi! I have a gallery page that uses a CSS and JS library but for the sake of performance, I would love it if it only loaded when the user is on the Gallery page.

Is this possible?

You modify the theme templates so the scripts show conditionally. You can check conditions such as front matter or section to load the script.

1 Like