Support for SSI (Server side include)

Hi there,
I am afraid the answer is no, but here it goes: does Netlify support Server Side Includes?

I want to link a stylesheet just if the cookie is present, as below:

<link rel="stylesheet" href="/path/to/full.css">
	/* critical CSS styles for this template go here... */

@lucabol Welcome to the Netlify community.

Netlify does not support SSI (or PHP, or other such technologies). However, you should be able to get the same end result using JavaScript. It won’t be as fast as SSI, though.

Yep. I was looking for the speed up. Thanks anyhow.

Would a function possibly do what you need?

Yes, it would, but I hate to lose the simplicity of not having a backend at all. SSI is good for that. I prefer to take the speed hit.

@lucabol Understood. Just remember that if you include any HTML upon which you want to add styling via JavaScript (a menu system with highlighting, for example), you might have to include the styling JavaScript at the end of the included HTML section so it will execute properly. The easiest way I have found to do this is via jQuery’s .load() command.

Thanks for taking the time to help. I am quite familiar with the whole progressive enhancement workflow. But I will do it without JQuery :wink:

I’ve tried every combination of Ajax and Vanilla JS I could come up with, but for loading common blocks of HTML pages jQuery worked best, and was the easiest to implement by far. This is in addition to the fact that loading scraps of HTML that include JS actually works as expected with jQuery. I understand the desire to avoid it, but it does work.

btw I had good luck with HTMX to load Html fragments.

But that’s not the issue here, SSI was simply an optimization to send the right HTML upfront instead of loading it client-side. But that’s not possible.

In any case, thanks for promptly answering my question.

@lucabol I’ll check out HTMX.