Browse Source

Some HTML Lint work

Remove google_analytics from the blogit.py code,
add it to template snippet
oz123 11 years ago
parent
commit
b7c27fb968
3 changed files with 22 additions and 22 deletions
  1. 2 15
      blogit.py
  2. 9 7
      templates/base.html
  3. 11 0
      templates/google_analytics.html

+ 2 - 15
blogit.py

@@ -1,7 +1,6 @@
 #!/usr/bin/env python
 
-# Copyleft (C) 2010 Mir Nazim <hello@mirnazim.org>
-# Copyleft (C) 2013 Oz Nahum <nahumoz@gmail.com>
+# Copyright (C) 2013 Oz Nahum <nahumoz@gmail.com>
 #
 # Everyone is permitted to copy and distribute verbatim or modified
 # copies of this license document, and changing it is allowed as long
@@ -75,19 +74,7 @@ GLOBAL_TEMPLATE_CONTEXT = {
     'twitter': 'https://twitter.com/#!/OzNTiram',
     'stackoverflow': "http://stackoverflow.com/users/492620/oz123",
     'github': "https://github.com/oz123",
-    'google_analytics': """
-<script type="text/javascript">
-  var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-36587163-1']);
-  _gaq.push(['_trackPageview']);
-
-  (function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-  })();
-</script>""",
-    'disquss' : """<div id="disqus_thread"></div>
+    'disquss': """<div id="disqus_thread"></div>
         <script type="text/javascript">
             /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
             var disqus_shortname = 'oz123githubcom'; // required: replace example with your forum shortname

+ 9 - 7
templates/base.html

@@ -1,16 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
+"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html>
-<script type="text/javascript">
-<!--[if IE]>
- window.location.href = "http://oz123.github.com/explorer.html";
-<![endif]-->
-</script>
 <head>
   <title>{% block page_title %} Home {% endblock %} &raquo; oz123.github.com</title>
   <link rel="stylesheet" type="text/css" href="/media/css/pygments_style.css" media="screen" /> 
   <link rel="stylesheet" type="text/css" href="/media/css/site.css" media="screen" /> 
   {% block css %}{% endblock %}
   <link href="{% block head_feed_link %}/atom.xml{% endblock %}" type="application/atom+xml" rel="alternate" title="{% block head_feed_title %}Oz's github &raquo; Oz's Weblog{% endblock %}" /> 
-<link rel="stylesheet" type="text/css" media="screen" href="http://www.devslide.com/public/labs/browser-detection/browser-detection.css" />
+  <link rel="stylesheet" type="text/css" media="screen" href="http://www.devslide.com/public/labs/browser-detection/browser-detection.css" />
+    <script type="text/javascript">
+    <!--[if IE]>
+    window.location.href = "http://oz123.github.com/explorer.html";
+    <![endif]-->
+</script>
 </head>
 <body>
 <div id="page" class="loading">
@@ -30,6 +32,6 @@
 </div>
 
 {% include 'sidebar.html' %}
-{{google_analytics}}
+{% include 'google_analytics.html' %}
 </body>
 </html>

+ 11 - 0
templates/google_analytics.html

@@ -0,0 +1,11 @@
+<script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-36587163-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+</script>