Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
feat(layout): let plugin decide the script placement
Browse files Browse the repository at this point in the history
  • Loading branch information
ppoffice committed Jul 27, 2018
1 parent 9c084f3 commit 63bdd0d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions layout/common/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@
<%- css('css/style') %>

<script defer src="//use.fontawesome.com/releases/v5.0.8/js/all.js"></script>

<% if (has_config('plugins')) { %>
<% for (let plugin in get_config('plugins')) { %>
<%- partial('plugins/' + plugin, {head: true}) %>
<% } %>
<% } %>
2 changes: 1 addition & 1 deletion layout/common/scripts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<% if (has_config('plugins')) { %>
<% for (let plugin in get_config('plugins')) { %>
<%- partial('plugins/' + plugin) %>
<%- partial('plugins/' + plugin, {head: false}) %>
<% } %>
<% } %>

Expand Down
2 changes: 1 addition & 1 deletion layout/plugins/gallery.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if (!(has_config('plugins.gallery') && get_config('plugins.gallery') === false)) { %>
<% if (!head && !(has_config('plugins.gallery') && get_config('plugins.gallery') === false)) { %>
<script src="//cdnjs.cloudflare.com/ajax/libs/lightgallery/1.6.8/js/lightgallery-all.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/justifiedGallery/3.6.5/js/jquery.justifiedGallery.min.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion layout/plugins/google-analytics.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if (has_config('plugins.google-analytics.tracking_id')) { %>
<% if (head && has_config('plugins.google-analytics.tracking_id')) { %>
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= get_config('plugins.google-analytics.tracking_id') %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
Expand Down
2 changes: 1 addition & 1 deletion layout/plugins/mathjax.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if (!(has_config('plugins.mathjax') && get_config('plugins.mathjax') === false)) { %>
<% if (!head && !(has_config('plugins.mathjax') && get_config('plugins.mathjax') === false)) { %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script>
MathJax.Hub.Config({
Expand Down

1 comment on commit 63bdd0d

@ppoffice
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#54

Please sign in to comment.