Moving the head

Google rates websites on their length, meaning web developers now have to push to reduce the amount of code on their websites. Something that has proven worthwhile after research is to move all of the head information to a seperate file, this achieves two things. Firstly the site has a much smaller amount of code on it, which means its going to rank higher for seo and secondly, it is worthwhile because the time saved making the entire site adds up when you consider you only have to edit the head once to effect every page.

This is something I wanted to practise before creating my next project, so below is an example of this completed.

First the index.html file where the head holds the php include;

Schermata 2016-02-09 alle 18.39.13.png

Secondly the head.php file which has all of the head data for the site;

Schermata 2016-02-09 alle 18.38.53.png

Finally the stylesheet.css is connected through the head file;

Schermata 2016-02-09 alle 18.39.02.png

This makes the website appear as normal, but the previously mentioned benifits.

Schermata 2016-02-09 alle 18.50.56.png

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s