Преглед на файлове

Add option to sort resource scripts

Page scripts can now be given a sortOrder param on their page, and this
will be used when printing them to the page. If the param isn't present,
scripts will be sorted by name, as usual.
Apis Necros преди 2 години
родител
ревизия
a2edee3530
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      layouts/projects/bare.html

+ 3 - 3
layouts/projects/bare.html

@@ -3,12 +3,12 @@
     {{- partial "head.html" . -}}
     <body>
         <div class="h-screen flex flex-flow flex-wrap">
-            <div id="content" class="flex-1 px-4">
+            <div id="content" class="flex-1">
             {{- .Content }}
             </div>
         </div>
-        {{- range .Resources }}
-        <script src="{{ .Permalink }}"></script>
+        {{- range sort (.Resources.Match "**.js") ".Params.SortOrder" "asc" }}
+        <script src="{{ .Permalink }}" data-sort-param="{{ .Params.SortOrder }}"></script>
         {{- end }}
     </body>
 </html>