Putting page specific Javascript into footer block

Is it possible to insert Javascript specific to the current page / archetype into a universal footer partial?

For example if my partial looks like:

        <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
        <script src="/js/bootstrap.min.js"></script>
        <script src="/js/bootswatch.js"></script>
        <script src="/js/test.js"></script>

Is there someway I could define a page or archetype specific include?

For instance in Rails erb I have a yield statement in my template:

<%= yield :javascript %>

And then I can define that javascript block in my pages themselves with:

<% content_for :javascript do %>
    <%= javascript_tag do %>
        var foo = 'example');
    <% end %>
<% end %>

Is Hugo capable of something equivalent?

The upcoming Hugo 0.14 has support for Ace’s base and inner templates, with a yield keyword:


1 Like


Is there a schedule somewhere for the 0.14 release?

@spf13 told me last night that he will do it this weekend.