cfg: make SPA optional
This commit is contained in:
		@@ -10,6 +10,7 @@
 | 
			
		||||
    {{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
 | 
			
		||||
    {{- range $cleanedInbound | uniq -}}
 | 
			
		||||
      {{$l := printf "%s%s/" $host .}}
 | 
			
		||||
      {{$l = cond (eq $l "//") "/" $l}}
 | 
			
		||||
      {{with (index $contentTable .)}}
 | 
			
		||||
      <li>
 | 
			
		||||
          <a href="{{$l}}">{{index (index . "title")}}</a>
 | 
			
		||||
 
 | 
			
		||||
@@ -16,3 +16,14 @@
 | 
			
		||||
</style>
 | 
			
		||||
{{ $js := resources.Get "js/graph.js" | resources.Fingerprint "md5" }}
 | 
			
		||||
<script src="{{ $js.Permalink }}"></script>
 | 
			
		||||
<script>
 | 
			
		||||
drawGraph(
 | 
			
		||||
  {{strings.TrimRight "/" .Page.Permalink}},
 | 
			
		||||
  {{strings.TrimRight "/" .Site.BaseURL}},
 | 
			
		||||
  {{$.Site.Data.graphConfig.paths}},
 | 
			
		||||
  {{$.Site.Data.graphConfig.depth}},
 | 
			
		||||
  {{$.Site.Data.graphConfig.enableDrag}},
 | 
			
		||||
  {{$.Site.Data.graphConfig.enableLegend}},
 | 
			
		||||
  {{$.Site.Data.graphConfig.enableZoom}}
 | 
			
		||||
);
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,7 @@
 | 
			
		||||
          content,
 | 
			
		||||
        }))
 | 
			
		||||
  </script>
 | 
			
		||||
  {{if $.Site.Data.config.enableSPA}}
 | 
			
		||||
  <script type="module">
 | 
			
		||||
    import { router, navigate } from "https://unpkg.com/million/dist/router.mjs";
 | 
			
		||||
    // SPA navigation for access later
 | 
			
		||||
@@ -89,5 +90,8 @@
 | 
			
		||||
    window.addEventListener("million:navigate", callback);
 | 
			
		||||
    window.addEventListener("DOMContentLoaded", callback);
 | 
			
		||||
  </script>
 | 
			
		||||
  {{else}}
 | 
			
		||||
  <script>window.navigate = (url) => window.location.href = url</script>
 | 
			
		||||
  {{end}}
 | 
			
		||||
</head>
 | 
			
		||||
{{ template "_internal/google_analytics.html" . }}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user