Server Side Includes Alternative

Technology similar to Server Side Include, but pre-generated

Answering my own question in case any others might come across the same issue.

I ended up using jekyll, which is a ruby-powered static site generator.

I chose jekyll mainly because it is built in to Github Pages, meaning that my static site will be able to take advantage of Github's free hosting options.

Alternative to PHP includes?

An .htaccess rule would work, if you setup 301 redirects it will notify search engines of your change and there should not be any seo repurcussions. This will redirect that for you. The other benefit for seo is php includes are server side so the html will be passed to the search engine spider for index, where javascript will execute after the document loads, and most spiders are not going to execute your JS, just index the html passed down from the server.

    RewriteEngine on 
RewriteBase /
RewriteRule (.*).htm$ /$1.php [R=301,NC]

ASP.NET equivalent of server side includes

You now have a number of options that provide this effect, but in a different manner.

  • User Controls (.ascx)
  • Master Pages (.master)
  • Server Side Controls (.dll)
  • Class Libraries (.dll)
  • App_Code Classes (.cs/.vb)

Each are used for differently to achieve different things. It depends what you're really trying to do. Given the name of your include file, I'd imagine you're trying to include library functions that will be used within the context of your page.

Consequently you'd write a class library that contains the methods and import them into your application/aspx.

If you're looking at templating a page that will do most of the layout work to provide a body for differing content then you'll be interested in Master Pages.

If you're looking at templating controls that can be used in many pages, then you're going to be after User Controls.

If you're looking at templating controls that can be used by many users across many projects, then you'll be looking at Server Side Controls.

If you're looking at a library of classes/methods then you'll develop a class library or use an app_code class which can be JIT compiled the first time it's called. This could at a stretch be considered more like classic ASP, but really it functions more like a class from a class library as a single unit. You can call it from within your codebehind or within <% %> tags in your aspx/ascx code without requiring a reference to a class library.

We don't really use "includes" per se any more, but each of these tools in your toolkit allow you to provide similar concepts for different scenarios. As a developer you will interact with the entire page lifecycle of your web pages differently. ASP.NET is a very different beast than classic ASP. It truly takes a different view/approach and will take some amount of patience to figure out the differences.

When to use Server Side Includes?

The SSI syntax is very simple, and it's built into apache, so it is probably faster than anything that's not an apache module, and WAY faster and less resource intensive than CGI (the spawn-an-arbitrary-executable-process-for-each-request kind that hardly anyone uses nowadays).



Related Topics



Leave a reply



Submit