Access GLOBAL_CONTEXT from template with shortcode

26 views
Skip to first unread message

chow...@gmail.com

unread,
Aug 12, 2016, 4:38:15 AM8/12/16
to nikola-discuss
Hi 

I am trying to put some data in GLOBAL_CONTEXT in conf.py, so I could use them to customize a theme.  

GLOBAL_CONTEXT = {
    "hyde_subtheme": "test",
    "enable_social_icon": True,
    "social_icons": (
        ("email", "/images/envelope1.png", "url1"),
        ("twitter","/images/twitter-black-shape1.png", "url2"),
        ("github", "/images/github-character1.png", "url3"),
    )
}

In base_footer.tmpl, I have this:

{% macro html_footer() %}
    {% if content_footer %}
        <footer id="footer">
            <p class="footer">
              {{ enable_social_icon }}
              {% if enable_social_icon  %}
              <span class="icon_row">
                {% for text, image, url in social_icons %}
                <a href="{{ url }}">
                  <img class="social_icon" src="{{ image }}" title="{{ text }}" width="24" /></a> &middot;
                {% endfor %}
              </span>
              <br/><br/>
              {% endif %}
              <span class="copyright">
              {{ content_footer }}
            </span>
            </p>
            {{ template_hooks['page_footer']() }}
        </footer>
    {% endif %}
{% endmacro %}


However, the template isn't picking up any of the data I included in GLOBAL_CONTEXT.  Am I missing anything?

Thank you,
CHOWY

Chris Warrick

unread,
Aug 12, 2016, 6:22:50 AM8/12/16
to Nikola—Discuss
Right now, we don’t provide any useful context to template shortcodes.
That will be fixed as part of
https://github.com/getnikola/nikola/issues/2424 soon™.

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

chow...@gmail.com

unread,
Aug 12, 2016, 11:46:19 PM8/12/16
to nikola-discuss
Noted thanks. 
Reply all
Reply to author
Forward
0 new messages