I am taking the CMS for Developers course and he is referencing a layouts.css file that has the template for the drag and drop layout, but I am unable to find it in my boilerplate. I am sure it is a complete download, but I know that it is regularly updated.
Since the video was shot on the old interface of HubSpot, I am assuming it is old and may have been sunset. I’m going to likely need it to pass the test at the end, so I am wondering if anyone can fill me in on if this got renamed, or if I may have overlooked it. It’s definitely not in a the directory it shows on the video and I don’t know Hubl so I’m assuming the test will be difficult without it.
Hey, @DChimenti20
Were you able to get the test completed? Also, can you link me to the video and timestamp where you see the discrepancy, please? Thanks! — Jaycee
Hi Jaycee - here is the link below. He mentions it at ~2:30 and it is also mentioned again the prep for the practicum video on the practicum page. The prep for the practicum video is from 2021, so I’m assuming they may have updated functionality and what I need lives elsewhere now.
Drag and drop areas in the HubSpot CMS
I also couldn’t fit it in the Github repository.
This is just something I’m doing because I should be able to easily, so I wouldn’t worry too much. I am at the point where I’ve created the Module I need to make, but need to make the Section next so I can test out my Module and ensure my fields and meta files are correct. After that, all you really need is the partial global header and footer and two drag and drop sections and it should be pretty simple.
I only have 11 days left on my trial and it says it takes up to 7 days to complete grading, so I doubt I will get it all done either way. I’ll almost definitely hit some road blocks as I’ve never used this CMS for these purposes before. It does say you need to have a Drag and Drop area though, so I wouldn’t pass without it either way.
Drag and drop area
- Must have two columns with an image module and a rich text module.
- These modules must have default content set inside the template
One more thing I forgot. I should have most of this done as long as I get the css file that gives it drag and drop. I built the custom section and module, so as long as I did it correctly I should be in good shape.
I spent a good amount of time today developing the custom module locally. It says that you need a fields.json and meta.json to go with the module. For some reason it would not let me upload either to the modules folder I made and the reason was that the type of “text” was not allowed.
This is confusing though, because I pulled it off the boilerplate and off the documentation for the exercise. It is listed in the documentation under “Field-based parameters”.
I was able to develop the module in the CMS and have the overall fields.json and theme.json files uploaded already, so as long as there is a fields.json and meta.json file in the module I developed in the CMS, I should be good. I’m just unsure because it only renders as a complete module in the CMS and it doesn’t reflect the separate html, css, or js files either. Also, it does show the other json files I uploaded elsewhere, so I’m unsure if I am covered by developing it in the CMS or not.
If you know the answer to this, you can probably save me a headache or two over trying to amend and upload these files over and over again after local development in VSCode. Thank you!
Hey @DChimenti20,
As the growth-theme is build upon the Boilerplate, you can grab it from there. It’s located in css/objects.
Here’s the whole/unmodified CSS to copy:
![]()
Spoiler
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before, .row-fluid:after {
display: table;
content: "";
}
.row-fluid:after {
clear: both;
}
.row-fluid [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 1px;
margin-left: 2.127659574%;
*margin-left: 2.0744680846382977%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .span12 {
width: 99.99999998999999%;
*width: 99.94680850063828%;
}
.row-fluid .span11 {
width: 91.489361693%;
*width: 91.4361702036383%;
}
.row-fluid .span10 {
width: 82.97872339599999%;
*width: 82.92553190663828%;
}
.row-fluid .span9 {
width: 74.468085099%;
*width: 74.4148936096383%;
}
.row-fluid .span8 {
width: 65.95744680199999%;
*width: 65.90425531263828%;
}
.row-fluid .span7 {
width: 57.446808505%;
*width: 57.3936170156383%;
}
.row-fluid .span6 {
width: 48.93617020799999%;
*width: 48.88297871863829%;
}
.row-fluid .span5 {
width: 40.425531911%;
*width: 40.3723404216383%;
}
.row-fluid .span4 {
width: 31.914893614%;
*width: 31.8617021246383%;
}
.row-fluid .span3 {
width: 23.404255317%;
*width: 23.3510638276383%;
}
.row-fluid .span2 {
width: 14.89361702%;
*width: 14.8404255306383%;
}
.row-fluid .span1 {
width: 6.382978723%;
*width: 6.329787233638298%;
}
.container-fluid {
*zoom: 1;
}
.container-fluid:before, .container-fluid:after {
display: table;
content: "";
}
.container-fluid:after {
clear: both;
}
@media (max-width: 767px) {
.row-fluid {
width: 100%;
}
.row-fluid [class*="span"] {
display: block;
float: none;
width: auto;
margin-left: 0;
}
}
@media (min-width: 768px) and (max-width: 1139px) {
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before, .row-fluid:after {
display: table;
content: "";
}
.row-fluid:after {
clear: both;
}
.row-fluid [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 1px;
margin-left: 2.762430939%;
*margin-left: 2.709239449638298%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .span12 {
width: 99.999999993%;
*width: 99.9468085036383%;
}
.row-fluid .span11 {
width: 91.436464082%;
*width: 91.38327259263829%;
}
.row-fluid .span10 {
width: 82.87292817100001%;
*width: 82.8197366816383%;
}
.row-fluid .span9 {
width: 74.30939226%;
*width: 74.25620077063829%;
}
.row-fluid .span8 {
width: 65.74585634900001%;
*width: 65.6926648596383%;
}
.row-fluid .span7 {
width: 57.182320438000005%;
*width: 57.129128948638304%;
}
.row-fluid .span6 {
width: 48.618784527%;
*width: 48.5655930376383%;
}
.row-fluid .span5 {
width: 40.055248616%;
*width: 40.0020571266383%;
}
.row-fluid .span4 {
width: 31.491712705%;
*width: 31.4385212156383%;
}
.row-fluid .span3 {
width: 22.928176794%;
*width: 22.874985304638297%;
}
.row-fluid .span2 {
width: 14.364640883%;
*width: 14.311449393638298%;
}
.row-fluid .span1 {
width: 5.801104972%;
*width: 5.747913482638298%;
}
}
@media (min-width: 1280px) {
.row-fluid {
width: 100%;
*zoom: 1;
}
.row-fluid:before, .row-fluid:after {
display: table;
content: "";
}
.row-fluid:after {
clear: both;
}
.row-fluid [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 1px;
margin-left: 2.564102564%;
*margin-left: 2.510911074638298%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .span12 {
width: 100%;
*width: 99.94680851063829%;
}
.row-fluid .span11 {
width: 91.45299145300001%;
*width: 91.3997999636383%;
}
.row-fluid .span10 {
width: 82.905982906%;
*width: 82.8527914166383%;
}
.row-fluid .span9 {
width: 74.358974359%;
*width: 74.30578286963829%;
}
.row-fluid .span8 {
width: 65.81196581200001%;
*width: 65.7587743226383%;
}
.row-fluid .span7 {
width: 57.264957265%;
*width: 57.2117657756383%;
}
.row-fluid .span6 {
width: 48.717948718%;
*width: 48.6647572286383%;
}
.row-fluid .span5 {
width: 40.170940171000005%;
*width: 40.117748681638304%;
}
.row-fluid .span4 {
width: 31.623931624%;
*width: 31.5707401346383%;
}
.row-fluid .span3 {
width: 23.076923077%;
*width: 23.0237315876383%;
}
.row-fluid .span2 {
width: 14.529914530000001%;
*width: 14.4767230406383%;
}
.row-fluid .span1 {
width: 5.982905983%;
*width: 5.929714493638298%;
}
}
/* Clearfix */
.clearfix {
*zoom: 1;
}
.clearfix:before, .clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both;
}
/* Visibilty Classes */
.hide {
display: none;
}
.show {
display: block;
}
.invisible {
visibility: hidden;
}
.hidden {
display: none;
visibility: hidden;
}
/* Responsive Visibilty Classes */
.visible-phone {
display: none !important;
}
.visible-tablet {
display: none !important;
}
.hidden-desktop {
display: none !important;
}
@media (max-width: 767px) {
.visible-phone {
display: inherit !important;
}
.hidden-phone {
display: none !important;
}
.hidden-desktop {
display: inherit !important;
}
.visible-desktop {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 1139px) {
.visible-tablet {
display: inherit !important;
}
.hidden-tablet {
display: none !important;
}
.hidden-desktop {
display: inherit !important;
}
.visible-desktop {
display: none !important ;
}
}
best,
Anton
As of text fields:
Text fields are allowed only in module fields.json . Theme fields.json don’t support text fields.
As long as the module is getting displayed in the Design-Manager, you’re good.
If meta.json would be missing, the module wouldn’t appear in the Design-Manager.
best,
Anton
That makes sense on the meta file and thank you for the layout.css file too. Big help!
The text field is in the fields.json file, but I’m assuming that that file will be present in there too anyway, since I am customizing the fields when building it in the design manager.
I basically got this done last night, but this is my first time using repeaters in HubSpot so I’ve hit a small snag on those. Other than that I should hopefully have this done today.
If you have any pointers on using repeaters it would be helpful. The challenge I am facing is that they keep rendering vertically when I use the add function and I have tried every css property in the book on their container wrapper (flex-wrap: wrap, flex-direction: row, etc.) to get them to add horizonally. If this were just html I would’ve had it done yesterday but it’s actually more fun trying to figure out why it’s not behaving the way I need it to.
Once I figure out that and whether I want to apply the media query they request for the 900 px screen on the module or add it to the layout file, I’ll be done.
If you have any pointers on that, it would be awesome. If I don’t hear from you I will mark your answer as the solution, because you did solve the layout.css challenge.
Thanks for your help!
Hey @DChimenti20,
yeah. Repeaters can be a bit confusing if you’re just starting ![]()
Here’s the loops(repeaters) documentation
For rendering them horizontally it’s depending on your structure.
<div class="horzNav">
<ul class="horzList">
{% for item in module.nav_items %}
<li>{{ item }}</li>
{% endfor %}
</ul>
</div>
.horzNav{
width:100vw;
overflow:hidden;
padding:1rem;
}
ul.horzList{
display:flex;
flex-direction:row;
gap:2rem;
list-style:none;
padding:0;
margin:0;
}
try this code from above
best,
Anton
We’re supposed to hand in our own work, so I wouldn’t want to take an entire solution from someone else, but I really appreciate your advice there. I also feel like I should be getting this right, since I’m following the documentation on it.
If you can take a look at what I am doing and let me know where it is wrong, it would be awesome. That way I know it’s not some setting on CMS and it’s just me overlooking something in my code
HTML
<div class=“container”>
{% for item in module.member_fields %}
<div class=“item”>
{% if module.team_member_fields.member_photo.src %}
{% set sizeAttrs = ‘width=“{{ module.team_member_fields.member_photo.width|escape_attr }}” height=“{{ module.team_member_fields.member_photo.height|escape_attr }}”’ %}
{% if module.team_member_fields.member_photo.size_type == ‘auto’ %}
{% set sizeAttrs = ‘width=“{{ module.team_member_fields.member_photo.width|escape_attr }}” height=“{{ module.team_member_fields.member_photo.height|escape_attr }}” style=“max-width: 100%; height: auto;”’ %}
{% elif module.team_member_fields.member_photo.size_type == ‘auto_custom_max’ %}
{% set sizeAttrs = ‘width=“{{ module.team_member_fields.member_photo.max_width|escape_attr }}” height=“{{ module.team_member_fields.member_photo.max_height|escape_attr }}” style=“max-width: 100%; height: auto;”’ %}
{% endif %}
{% set loadingAttr = module.team_member_fields.member_photo.loading != ‘disabled’ ? ‘loading=“{{ module.team_member_fields.member_photo.loading|escape_attr }}”’ : ‘’ %}
<img src=“{{ module.team_member_fields.member_photo.src|escape_url }}” alt=“{{ module.team_member_fields.member_photo.alt|escape_attr }}” {{ loadingAttr }} {{ sizeAttrs }}>
{% endif %}
<h2>{% inline_text field=“team_member_fields.member_name” value=“{{ module.team_member_fields.member_name }}” %}</h2>
{% inline_text field=“team_member_fields.job_title” value=“{{ module.team_member_fields.job_title }}” %}
</div>
{% endfor %}
</div>
CSS
.container{
width: 100%;
display: flex;
}
.item{
width: 100%;
}
.row {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(300px,100%), 1fr));
}
Hey @DChimenti20,
thanks for the detailed information.
I’d say you’re very close on your path.
When working with loops/repeaters you have to change the code of the elements a little bit.
Just an example:
If you’re using a text field(or any other field) outside a loop, you write it like this:
{% inline_text field="team_member_fields.job_title" value="{{ module.team_member_fields.job_title }}" %}
or simply
{{ module.team_member_fields.job_title }}
In a loop you’d write it like
{% for member in module.REPEATERFIELD/GROUP %}
{{ member.job_title }} {# <- "module" gets replaced by the word after "for" here #}
{% endfor %}
the “word” after for is completely up to you. The only thing to keep in mind is to not use spaces or dashes(“-”). Underscores(“_”) are ok.
This code should do the job:
<div class="container">
{% for item in module.member_fields %}
<div class="item">
{% if item.member_photo.src %}
{% set sizeAttrs = 'width="{{ item.member_photo.width|escape_attr }}" height="{{ item.member_photo.height|escape_attr }}"' %}
{% if item.member_photo.size_type == 'auto' %}
{% set sizeAttrs = 'width="{{ item.member_photo.width|escape_attr }}" height="{{ item.member_photo.height|escape_attr }}" style="max-width: 100%; height: auto;"' %}
{% elif item.member_photo.size_type == 'auto_custom_max' %}
{% set sizeAttrs = 'width="{{ item.member_photo.max_width|escape_attr }}" height="{{ item.member_photo.max_height|escape_attr }}" style="max-width: 100%; height: auto;"' %}
{% endif %}
{% set loadingAttr = item.member_photo.loading != 'disabled' ? 'loading="{{ item.member_photo.loading|escape_attr }}"' : '' %}
<img src="{{ item.member_photo.src|escape_url }}" alt="{{ item.member_photo.alt|escape_attr }}" {{ loadingAttr }} {{ sizeAttrs }}>
{% endif %}
<h2>{% inline_text field="item.member_name" value="{{ item.member_name }}" %}</h2>
{% inline_text field="item.job_title" value="{{ item.job_title }}" %}
</div>
{% endfor %}
</div>
best,
Anton
I actually ended up going with a from scratch approach with some of your insights.
I now have it where it is working in the preview, but since I haven’t yet attached a drag and drop style sheet to a template, I haven’t been able to test it.
This is what I went with so far. If you see any problems I may run into with this, please let me know, but I’ll be marking your answer as a solution either way.
Thanks for your help!
HTML
<div class=“container”>
{% for item in module.item %}
<div class=“item”>
{% if item.image_field.src %}
{% set sizeAttrs = ‘width=“{{ item.image_field.width|escape_attr }}” height=“{{ item.image_field.height|escape_attr }}”’ %}
{% if item.image_field.size_type == ‘auto’ %}
{% set sizeAttrs = ‘width=“{{ item.image_field.width|escape_attr }}” height=“{{ item.image_field.height|escape_attr }}” style=“max-width: 100%; height: auto;”’ %}
{% elif item.image_field.size_type == ‘auto_custom_max’ %}
{% set sizeAttrs = ‘width=“{{ item.image_field.max_width|escape_attr }}” height=“{{ item.image_field.max_height|escape_attr }}” style=“max-width: 100%; height: auto;”’ %}
{% endif %}
{% set loadingAttr = item.image_field.loading != ‘disabled’ ? ‘loading=“{{ item.image_field.loading|escape_attr }}”’ : ‘’ %}
<img src=“{{ item.image_field.src|escape_url }}” alt=“{{ item.image_field.alt|escape_attr }}” {{ loadingAttr }} {{ sizeAttrs }}>
{% endif %}
{% inline_text field=“text_field” value=“{{ item.text_field }}” %}
{% inline_rich_text field=“richtext_field” value=“{{ item.richtext_field }}” %}
</div>
{% endfor %}
</div>
CSS
.container{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
width: 100%;
}
.item{
flex: 0 0 294px;
text-align: center;
align-items: center;
justify-content: center;
color: #222222;
flex-direction: column;
}
img{
width: 294px;
height: 299px;
}
@media(max-width: 897px) {
.item {
flex: 0 0 50%;
max-width: 50%;
}
}
Hey @DChimenti20,
cool!
Looks great, but there’s a small thing you should change in the for loop:
{% for item in module.item %}
won’t work unless your repeater group is called “item”. Sorry for the misleading instruction.
As your group is called “Team member fields” it should be like this:
{% for item in module.team_member_fields %}
or
{% for member in module.team_member_fields %}
(you’d need to replace “item” everywhere inside the loop with “member”)
…
How you want to name it, is completely up to you.
If you rename and change the value of the group, then you’ll need to change the team_member_fields at the “end” of the for loop.
In terms of CSS - While it’s a good practise to apply a dedicated CSS to your module, you have to keep in mind following things:
- If you’re using styling/classes that are already defined outside the module - you don’t need to add them to the module
- If you’re adding all your default CSS files to something like a main.css which is getting loaded on every page - you don’t need to add the same styles to the module
- If you add CSS to the module.css field of a module(Email modules don’t support custom css or JS), this file will be loaded once to any page that uses this module. Even if you decide to use the same module several times. The same applies to CSS/files that are being added through the sidebar or other ways to the module(there is at least one other option to add css files)
- If you want to have styling options per module instace, you can add require_css and scope_css like in the example (below this list) anywhere inside the module.html area(I recommend at the top) and add the style fields.
- Keep in mind that module CSS files will be loaded in the standard_header_includes tag (most likely inside the base.html) of your theme. This means that depending on your theme the most common load order is:
- main.css(and what ever order you have in there)
- theme-overrides.css (or what ever name it has in your theme)
- template specific CSS that are set on template level
- standard_header_includes
Example for 4.:
{% require_css %}
<style>
{% scope_css %}
.CLASS{
color: {{ module.styles.font_color.css }}
}
{% end_scope_css %}
</style>
{% end_require_css %}
hope this helps a bit more
best,
Anton
You’re 100% right, but I did start from scratch and rename it item and it’s been working so far.
I’m just trying to pass the practicum so I can make something a little sexier than I am making now down the road. It has the functionality or retaining width and dropping down to 2 items under 900px, so I’m content with that for now.
I am running into a problem where I made global partials for my header and footer, plus I went through and rewrote a like 2000 line fields.json file with everything I need, but even though it provides me the option to change text and color options on my header and footer, it doesn’t change them on my global partials when I try to change them.
This is my first page on HubSpot CMS so I kinda just assumed that if you link in the global partial header and footer, it would automatically assign it to those buttons in the CMS. It is recoginizing the areas as global content, it’s just not letting me edit them.
Is that something you have seen before?
Hey @DChimenti20,
edit: See answer in the other thread here


