This document explains the changes made to fix the template rendering issues in the DEV Partner Portal application.
The template system was experiencing issues with nested conditionals and complex template syntax. This resulted in template code being rendered directly in the HTML output instead of being processed correctly.
Examples of issues:
{{value}} appearing in the rendered output{{#if type == "select"}} showing up in the HTMLWe took a two-pronged approach to fix these issues:
We created the following simplified components:
/views/components/forms/simple-submission-form.html/views/components/forms/simple-magic-link-form.html/views/components/forms/simple-company-info-form.html/views/components/ui/simple-success-message.html/views/components/ui/simple-error-message.html/views/components/ui/simple-account-info.html/views/components/uploadcare/simple-image-gallery.html/views/components/ad-creation/simple-ad-preview.htmlThese components use direct HTML instead of complex template syntax, making them more reliable and easier to maintain.
We also created simplified versions of the main templates:
/views/templates/simple-landing-template.html/views/templates/simple-continue-template.htmlThese templates use the simplified components and avoid complex template syntax.
We updated the controllers to use the simplified templates:
// Updated renderLandingPage function
export async function renderLandingPage(c: Context): Promise<Response> {
const html = await renderTemplate("/views/templates/simple-landing-template.html", {}, import.meta.url);
return c.html(html);
}
// Updated renderContinuationPage function
export async function renderContinuationPage(c: Context): Promise<Response> {
// ...
const html = await renderTemplate("/views/templates/simple-continue-template.html", {
COMPANY_NAME: submission.companyName,
EMAIL: submission.email,
ID: id,
HOST: host
}, import.meta.url);
return c.html(html);
}
For a more robust solution in the future, we could:
However, the current simplified approach should be sufficient for the needs of the DEV Partner Portal application while being much more reliable than the previous implementation.