How to build a sitemap

A sitemap is very important if you want to search engines discover and index your site properly. Your site is a jungle of HTML, CSS and JavaScript files so the more you make it easier for search engines, the better. A sitemap.xml files one of the most and easiests way to implement.

Lazy load images with javascript

Why should you load your images in a lazy way? Among others reasons: Increase page speed:Better page rankMore visitorsReduce bounce rateIncrease pages / session rateImprove user experienceReduce infrastructure costs In a nutshell, this is the process: Modify all your <img /> tags by changing src by data-src or something elseAdd a specific class to every … Continue reading Lazy load images with javascript

Redirect all requests from HTTP to HTTPS un Node.js and Express

The first step will be to create a method to guess if the HTTP request comes from HTTP or HTTPS (secure or not secure). In some context like AWS or Heroku you will have to ask by the header x-forwarded-proto instead of req.secure. Have in mind that req.secure will return always false if there is … Continue reading Redirect all requests from HTTP to HTTPS un Node.js and Express

Http auth basic in Node js and Express

Let's build a small site in Node.js using Express that will have one protected page Http auth basic prompt dialog We are going to use express generator to generate some scaffolding. If you didn't install it just type this command to install it globally but if you already know all this stuff you might skip … Continue reading Http auth basic in Node js and Express