Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dump my MVC site to static files

I want to build a simple site with MVC but then render the "pages" and corresponding "assets" (js, css, images, etc) to what one might call a "static site".

In other words, I don't want to deploy to an IIS server that supports MVC. I simply want to build the site in MVC then somehow parse those pages into static html/css/etc files and upload the site to a regular LAMP host.

Is there an easy way to automate this? NuGet package? Binary? MVC extension like maybe a handler add-on that can render out the static site in a single pass?

like image 799
Matt Kocaj Avatar asked Jun 11 '12 04:06

Matt Kocaj


3 Answers

About 10 years back, I used to download whole websites for offline use using HTTrack Website Copier. May be you could download your own website which gives you nice hierarchy of your static web pages. If you think all your webpages are reachable through the homepage links, menu links etc then you can download most of your website. Basically you can google for web crawlers/ offline browsers/website downloaders etc. and run them to get your job done.

Alternatively if you know the pattern of urls, you could give it to download manager to download them. Not sure if it works with your website, but I do it sometimes.

HTH

like image 98
Anil Vangari Avatar answered Oct 23 '22 03:10

Anil Vangari


If your site depends on a database or some other dynamic source it will be close to impossible to dump all possible combinations of pages into static files. If on the other hand your site is pretty much static, saving the rendered HTML/JS/CSS source into files and uploading it to a LAMP server won't be too hard.

like image 32
Darin Dimitrov Avatar answered Oct 23 '22 05:10

Darin Dimitrov


You may wanna look at Pretzel, a .Net static site generator.

Update: Apparently it doesn't work on ASP.Net projects: Issue #123. It only supports Razor language for authoring content pages.

like image 1
Mrchief Avatar answered Oct 23 '22 03:10

Mrchief