If you need to pass in post variables to third-party or custom-written JavaScript, Jinja variables are a perfect solution.
These are often used for passing editorial tags, sections, and custom fields into ad tags.
Click here for more information.
Jinja variables are available to use in any custom HTML element.
Most Commonly Used Jinja Variables
Basename: {{post.basename}}
Available only on post pages
Post URL: {{post.post_url}}
Available only on post pages
Post Sections: {{sections}}
Available only on post pages
Post Primary Section Name: {{post.primary_section_name}}
Available only on post pages if primary section is set explicitly
Post Tags: {{tags}}
Available only on post pages
Section Page: {{subpage.title}}
Created Date: {{created_date}}
Current Year: {{libs.datetime.datetime.utcnow().year}}
Created Timestamp: {{Created_tse}}
Sub Page URL: {{subpage_url}}
Available only on section pages
Primary Section Slug: {{primary_section_slug}:}
Primary Section URL {{Primary_section_url}}
Does not work on post page
What Post Variables Are Available?
You can view all variables
here. There's also a simple way to view all variables if you add the JSONView extension to your Google Chrome browser. With it, you can clearly view a post's JSON data, as shown in this example. Any of your own articles will follow a similar format.
Example: Spot.IM Integration
In this example, Spot.IM is integrated using Jinja template variables to pass a Post ID and BaseName into the tags.
Users can click on any element in our Layout & Design tool and select a Jinja variable to insert. Here's an example on a Heading element:
Advanced Usage: Jinja Tag and Post Context Variables
We've exposed the most popular variables used as simple {{post.something}} variables, but sometimes you may need to access a variable that's not exposed. You can use the aforementioned JSONView Google Chrome extension to look at your own JSON and access any of those variables. But it's important to reference the context correctly. Here's an example:
Post Variables
Here are most of our post variables located in one place. The list contains some variables you can't see in JSON. For example, post.attrs (goes from XML to our Layout & Design tool) and post.is_mobile.
Using Variables to Control OG Tags
In our Layout & Design tool, you have the ability to create variable overrides. This is helpful when having to set the Open Graph (OG) tags in a section or post page, or in the <head> tag of a page.You can easily find all variables available by inserting the Variable Override element:
Then choose the one you need from the drop-down picklist:
We offer support for:
OG Image
OG Video
OG URL
OG Page Type
Facebook Share Title
Facebook Share Description
Site Language
Advanced Usage: Using Jinja With Conditions
For using conditions, loops, setting values, splitting, and slicing with Jinja, you should create a new Jinja element. This element should only be used by
developers with high levels of technical skill.
First, this element needs to be added from code:
By adding the code, you'll create the element:
Once the element is created, you can start adding your code.
You can also loop through tags or check if a particular value is present. Here's a code example:
{% if context.post.original_user_subsite.roar_specific_data %}
<div class="parner_container">
<div class="partner_headline">More From
<a class="partner_site_name">{{context.post.original_user_subsite.roar_specific_data.site_name}}</a>
</div>
{% for posts in context.post.original_user_subsite.roar_specific_data.posts %}
<div class="partner_posts"><a href="{{posts.url}}">{{posts.headline}} </a></div>
{% endfor %}
<div class="partner_site_info">This article originally appeared on
<a href="{{context.post.original_user_subsite.roar_specific_data.site_url}}">
{{context.post.original_user_subsite.roar_specific_data.site_name}} </a>
</div>
The list of these values can be found in the console, and you can find it by searching for rblms.require('bootstrap'). This is where you'll find the whole context list.
Remember, Jinja is a template engine that puts values in the places you add them to. This means it's scope dependent. So if you set one value based on a specific scope, you need to consider how it'll be displayed elsewhere.
Our platform is a complete digital publishing toolbox that's built for modern-day content creators, and includes game-changing features such as our:
Why RebelMouse?
Unprecedented Scale
RebelMouse sites reach more than 120M people a month, with an always-modern solution that combines cutting-edge technology with decades of media savvy. And due to our massive scale, 1 in 3 Americans have visited a website powered by RebelMouse.
120M+ Users
550M+ Pageviews
17+ Avg. Minutes per User
6+ Avg. Pages per User
Today's Top Websites Use RebelMouse
Thanks to the tremendous scale of our network, we are able to analyze a wealth of traffic data that informs our strategies and allows us to be a true strategic partner instead of just a vendor.
What Clients Say
We’re here to help you weigh and understand every tech and strategic decision that affects
your digital presence. Spend less time managing everything yourself, and more time focused on
creating the quality content your users deserve.
I love the control panel. Awesome work. I have to say, what an amazing creative team RebelMouse is. I am so grateful!
Terrence O'Hanlon
Founder and Chairman Reliabilityweb
It’s like we’ve been riding horses to commute all our lives and someone just showed us a Tesla.
Brendan Farley
Vice President, Product Management Strada Education Network
Thanks to RebelMouse, United doesn’t have to sacrifice great content for speed. You can have both!
Ryan Bujeker
Director, Social Media Strategy & Digital Engagement United Airlines
We're in a much better position to make it through the current crisis in part due to RebelMouse and their platform. We've not only saved on overhead costs, we've more easily optimized our traffic with their smart measuring and SEO tools, as well as their social integrations.
Jill Braff
President/Chief Operating Officer Brit + Co
THANK YOU for all the good, fast work you put into making our public rollout such a big success. I know we threw a lot at you very quickly, but you were calm under pressure and pulled it all off perfectly. Very glad to be working with you all.
Tim Grieve
Executive Editor Protocol
So inspired and impressed by these results from RebelMouse. Check them out and ask Andrea Breanna how they got there! Just goes to show that spending millions doesn't necessarily get you to the right destination. It's spending no more than you need on the right technology with the right platform that does! 🌐💙🏎️
Andrey Lipattsev
Partner Development Manager Google
It is not often I jump out of my chair and scream in a positive way, but I just did! This is the happiest I have seen my Managing Editor in 2021! Thank you.
Nick Smith
CEO Investing News Network
Working with RebelMouse is an actual treat. From the CEO down, every single member of the team has partnered with us to meet our needs. Everyone willingly (and with endless patience!) shares their expertise and insights to ensure we optimize search and create a great audience experience. As we have implemented the various search tactics, positive results are almost instantaneous. Training our content creators has been simple. The system is incredibly user friendly. As a co-worker commented, "RebelMouse doesn't just sell you something, they partner with you to deliver exactly what you want." I couldn't agree more!
Emma Schofield
Director of Change Management Investing News Network
We continue to be huge fans of RebelMouse and envision a very long-term relationship with the platform. The service has been impeccable.
Douglas Fischer
Executive Director Environmental Health News
I am a HUGE RebelMouse fan, and basically tell everyone I meet who's looking to overhaul their website to get in touch right away.
Susan Hassler
Editor Emeritus IEEE Spectrum
Every member of the RebelMouse team, but especially our project team, are superstars! Our site launch on the platform met all our expectations and we love the technology. We are positive about the future of our site and look forward to improving our approaches and processes with RebelMouse's guidance!
Terrence O'Hanlon
Founder and Chairman Reliabilityweb
RebelMouse's Layout & Design Tool is one of the most comprehensive and flexible tools I have ever used of any CMS. Their product team is also extremely helpful and constantly supports to make sure your properties are up to date and use the best industry standards, especially in terms of page speed.
Chuck Lapointe
CEO Narcity Media
The best thing about RebelMouse is how much they care about their customers. When working with them, I always get a sense that they go above and beyond for their customers. When working with the RebelMouse team, I very much consider them to be a partner, rather than just a vendor. Upon migrating to their technology, we have seen tremendous improvements in many key areas, particularly technical SEO. They have out-of-the-box functionality that is tremendously helpful to customers. At the same time, their system is flexible enough to allow us to adapt it to any new business needs that we have.
David Nguyen
Senior Director of Digital Marketing Investing News Network
RebelMouse has shepherded us through the modernization phase, and has been keen, practical, and nimble throughout the entire journey. They have helped modernize our website through an infinite scroll setup that allows us more advertising real estate while creating more time on site to capture reader engagement. Plus, the RebelMouse team has helped educate our own team on the various aspects of programmatic advertising and worked to best implement them. Premier Guitar joining forces with RebelMouse in 2020 was one of the best choices we could have made!
Luke Viertel
Digital Strategist Premier Guitar
RebelMouse has stepped up our content management process by providing a user-friendly interface, robust customization options, and seamless collaboration tools. The platform's analytics and reporting capabilities have empowered us to make data-driven decisions, while their exceptional customer support ensures any issues are promptly addressed in a professional, respectful, and friendly way!
RebelMouse employs a unique, diverse, and decentralized team that consists of 70+ digital traffic experts across more than 25 different countries. We have no central office, and we cover every time zone to ensure that we’re able to deliver amazing results and enterprise-grade support around the clock.
Our team is well-versed in all things product, content, traffic, and revenue, and we strategically deploy ourselves to help with each element across all of our clients. We thrive on solving the complex.