瀏覽代碼

Merge branch 'master' of https://git.o-for.net/marx/alucho

Danilo Gómez Gómez 5 年之前
父節點
當前提交
c149f704c2
共有 3 個文件被更改,包括 18 次插入6 次删除
  1. 8 0
      layout/_base.html
  2. 5 1
      run_server.sh
  3. 5 5
      sitegen.py

+ 8 - 0
layout/_base.html

@@ -1,6 +1,14 @@
 <!DOCTYPE html>
 <html lang="en">
 <head>
+	<!-- Global site tag (gtag.js) - Google Analytics -->
+	<script async src="https://www.googletagmanager.com/gtag/js?id=UA-148161067-1"></script>
+	<script>
+		window.dataLayer = window.dataLayer || [];
+		function gtag(){dataLayer.push(arguments);}
+		gtag('js', new Date());
+		gtag('config', 'UA-148161067-1');
+	</script>
 	<meta charset="UTF-8">
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
 	<meta http-equiv="X-UA-Compatible" content="ie=edge">

+ 5 - 1
run_server.sh

@@ -1,8 +1,12 @@
 #!/bin/bash
+
 python3 sitegen.py --with-index --watch &
 gen=$!
 
-python3 -m http.server -d build 8001 &
+sleep 1
+cd build
+
+python3 -m http.server 8001 &
 srv=$!
 
 trap "kill $gen; kill $srv" EXIT

+ 5 - 5
sitegen.py

@@ -149,7 +149,7 @@ def compile(env, path, target):
 
             dst = join(target, dst)
             dst_folder, _ = split(dst)
-            
+
             makedirs(dst_folder, exist_ok=True)
 
             template = env.get_template(join(cur_base, doc))
@@ -162,7 +162,7 @@ def init_gen(args):
     # Load layout
     file_loader = FileSystemLoader(args.source)
     env = args.env = Environment(loader=file_loader)
-    
+
     # Init gobals
     env.globals['lang'] = DEFAULT_LANG
 
@@ -217,7 +217,7 @@ def run(args):
 
     if not args.watch:
         return
-    
+
     print(f'watching {args.source}/*:{LANGUAGES}/*:{STATIC}/*:{ROOT}/*')
     while True:
         # take modification times
@@ -234,12 +234,12 @@ def run(args):
         if source_mt != new_source_mt:
             source_mt = new_source_mt
             save_generate(gen_layout, args, 'recompiling layout')
-        
+
         new_root_mt = mtimes(ROOT)
         if root_mt != new_root_mt:
             root_mt = new_root_mt
             save_generate(gen_root, args, 'copying root files')
-        
+
         new_static_mt = mtimes(STATIC)
         if static_mt != new_static_mt:
             static_mt = new_static_mt