{"id":208,"date":"2015-11-24T18:00:25","date_gmt":"2015-11-24T08:00:25","guid":{"rendered":"http:\/\/stevoz.com\/myweatherblog\/?p=208"},"modified":"2015-11-25T15:06:06","modified_gmt":"2015-11-25T05:06:06","slug":"update-to-my-weather-site","status":"publish","type":"post","link":"https:\/\/stevoz.com\/myweatherblog\/2015\/11\/update-to-my-weather-site\/","title":{"rendered":"Update to my Weather site"},"content":{"rendered":"<div style=\"width: 460px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/stevoz.com\/myweatherblog\/wp-content\/uploads\/sites\/2\/2015\/11\/WeatherSiteNew.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/stevoz.com\/myweatherblog\/wp-content\/uploads\/sites\/2\/2015\/11\/WeatherSiteNew-1024x921.jpg\" alt=\"WeatherSiteNew\" width=\"625\" height=\"562\" class=\"aligncenter size-large wp-image-226\" srcset=\"https:\/\/stevoz.com\/myweatherblog\/wp-content\/uploads\/sites\/2\/2015\/11\/WeatherSiteNew-1024x921.jpg 1024w, https:\/\/stevoz.com\/myweatherblog\/wp-content\/uploads\/sites\/2\/2015\/11\/WeatherSiteNew-300x270.jpg 300w, https:\/\/stevoz.com\/myweatherblog\/wp-content\/uploads\/sites\/2\/2015\/11\/WeatherSiteNew-624x561.jpg 624w, https:\/\/stevoz.com\/myweatherblog\/wp-content\/uploads\/sites\/2\/2015\/11\/WeatherSiteNew.jpg 1096w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">My new site&#8230;<\/p>\n<\/div><p>My <a href=\"https:\/\/stevoz.com\/weather\">weather site<\/a> had been feeling a bit tired. It was based on the templates that came with <a href=\"http:weewx.com\">WeeWX<\/a> which were written using earlier versions of HTML. I have added bits and pieces to the site over time just by tacking them on so my code was a bit of a mishmash. There was duplicated code everywhere, IDs used when they should have been classes, redundant IDs and classes and not the best layout. I had too many colours in use in the pages. I&#8217;d used three separate CSS files to style the weather pages with common code occupying the majority of these files. These old templates didn&#8217;t incorporate any of the more modern HTML5 or CSS3 code that is available.<\/p>\n<h3 id=\"html5\">HTML5<\/h3><p>The first thing I did was convert my templates to HTML5. This was simple, I just changed the declaration from<\/p>\n<pre class=\"brush: xml; light: true; title: ; notranslate\" title=\"\">&lt;!DOCTYPE HTML PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd&quot;&gt;\r\n&lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt;\r\n  &lt;head profile=&quot;http:\/\/www.w3.org\/2005\/10\/profile&quot;&gt;\r\n    ...\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;\r\n    ...\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre><p>to <\/p>\n<pre class=\"brush: xml; light: true; title: ; notranslate\" title=\"\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=&quot;en-AU&quot;&gt;\r\n  &lt;head&gt;\r\n    &lt;meta charset=&quot;utf-8&quot;&gt;\r\n    ...\r\n    &lt;link rel=&quot;stylesheet&quot; href=&quot;css\/normalize.css&quot;&gt;\r\n    ...\r\n    &lt;!--&#x5B;if lt IE 9]&gt;\r\n    &lt;script src=&quot;http:\/\/html5shim.googlecode.com\/svn\/trunk\/html5.js&quot;&gt;&lt;\/script&gt;\r\n    &lt;!&#x5B;endif]--&gt;\r\n    ...\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;\r\n    ...\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre><p>So much simpler. Now I can use elements like <code>&lt;nav&gt;<\/code>, <code>&lt;header&gt;<\/code> and <code>&lt;footer&gt;<\/code>. <\/p><p>In the code above, you can see where I link to normalize.css. Normalize.css is a customisable CSS file that provides better cross-browser consistency as it renders HTML elements in a default style and in line with modern standards. This sets all styles to a common starting point in most browsers. You can find more information and download normalize.css over on <a href=\"https:\/\/github.com\/necolas\/normalize.css\/\">Github<\/a>.<\/p><p>The next few lines refer to <code>http:\/\/html5shim.googlecode.com\/svn\/trunk\/html5<\/code>. These are there to enable HTML5 for people using Internet Explorer 9 or earlier. Hopefully there aren&#8217;t too many out there using this old browser but the link is put there for backward compatibility. It is ignored in more modern browsers. There is more information on this <a href=\"http:\/\/ejohn.org\/blog\/html5-shiv\/\">here<\/a>.<\/p>\n<h3 id=\"css\">CSS<\/h3><p>As I had three separate CSS files for the various pages, I combined them all into one. Part of this included going through the ID and class references in my HTML code and rationalising them. I realised I had several references to the same ID (IDs should be unique) and I&#8217;d used several class references when a single one would suffice. I was able to simplify my code considerably and from there was able to make some cosmetic changes to the pages. CSS3 allows much more styling, for example the <code>border-radius<\/code> used on the various boxes.<\/p>\n<h3 id=\"colours\">Colours<\/h3><p>The next thing I looked at was the colour palette for the site. I have linked to a couple of external tools (Weatherzone, Flag Counter, BOM) on the home page which have fixed colours so I utilised these as the basis for the palette.<\/p><p>I ended up with this range of colours in my palette:<\/p>\n<div class=\"colour_block_container\"><span class=\"colour_block\" style=\"background:#333333;color:#fff;\">#333333<\/span><span class=\"colour_block\" style=\"background:#4185A5;color:#fff;\">#4185A5<\/span><span class=\"colour_block\" style=\"background:#660066;color:#fff;\">#660066<\/span><span class=\"colour_block\" style=\"background:#f2f2f7;\">#F2F2F7<\/span><span class=\"colour_block\" style=\"background:#f5f5f5;\">#F5F5F5<\/span><span class=\"colour_block\" style=\"background:radial-gradient(#eee, #ccc);\">radial-gradient #EEE to #CCC<\/span><\/div><p><\/p><p>Once I had the palette, I went through my CSS and changed most of the colour references to these.<\/p>\n<h3 id=\"layout\">Layout<\/h3><p>The layout of the pages wasn&#8217;t the best with the column lengths varying greatly especially when viewed on different devices. I moved some sections around and styled others slightly differently. I think this will be a constant work in progress as I will be always be tweaking it here and there.<\/p>\n<h3 id=\"nextsteps\">Next Steps<\/h3><p>I want to make the pages fully responsive between devices. It is okay viewed on a desktop computer, a laptop and even a tablet, but viewing the pages on a mobile phone is not the best.<\/p><p>I have been looking at Bootstrap as a way of achieving this but I fear this will lead to another total revamp of the site. This should be fun but maybe a small break first!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My weather site had been feeling a bit tired. It was based on the templates that came with WeeWX which were written using earlier versions of HTML. I have added bits and pieces to the site over time just by tacking them on so my code was a bit of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":226,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[10],"tags":[],"class_list":["post-208","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-weather-site"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/stevoz.com\/myweatherblog\/wp-content\/uploads\/sites\/2\/2015\/11\/WeatherSiteNew.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5uBIO-3m","_links":{"self":[{"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/posts\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/comments?post=208"}],"version-history":[{"count":2,"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/posts\/208\/revisions"}],"predecessor-version":[{"id":241,"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/posts\/208\/revisions\/241"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/media\/226"}],"wp:attachment":[{"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/media?parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/categories?post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stevoz.com\/myweatherblog\/wp-json\/wp\/v2\/tags?post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}