Jekyll/Liquid form template with variables

I’d like to know if there are approaches to generate a page which fetches data from files in _data and a file defining page variables.

I suggested Jekyll includes as a typical solution for your problem.

Your question is too detailed. I would have left off the JS part as it doubles the snippet length and once the HTML substitution is solved then the JS is easy. Also I would recommend moving JS to a JS file defined as a function then call it on Jekyll on the page or in a layout.

  setUpForm("{{ page.form.title }}")