If you’re used to having a blog on WordPress, you’re accustomed to allowing visitors to index your blog posts by parameters such as date, popularity, and by category.Hubspot’s COS is not only an ultra-powerful web and marketing platform, its ability to add customization is also nearly limitless. Here’s a tutorial on how to add tabbed indexing of blog posts to a sidebar widget—in the growth-driven design circles, this add-on affectionately is called, “Tabber Tabs.” We’re using this code on our website. Just take a look at the sidebar to the right.
1) Download the Code.
Click here for the landing page that links to the the CSS and Hubl code you'll need for this project. You’ll need to copy and paste the code into a Hubl module and into a stylesheet.
After you get the code, paste it into a text editor like Notepad first. This step will make sure the code is “scrubbed” of additional code if somehow the code were to land in a word processor.
The tutorial below should be clear enough if you haven’t had much experience with the Hubspot COS or with manipulating markup code. Just make sure you don’t skip any steps and that you backup your stylesheet as I suggest.
2) Find Your Template
Let's get started.
- In your Hubspot dashboard, click on “Blog.”
- Click on “Manage List Template” in the left sidebar.
3) Install a HUBL Module
You now should be viewing your Hubspot COS Design Manager portal (Content > Design Manager) and the template you’re going to modify. Don’t worry too much if you mess something up on your template. You can roll back by clicking the Actions > View revisions.
- Find a </> HubL Template module on the left sidebar of the Design Manager.
- Drag the module onto your Blog Sidebar.
- Click on the module's drop down and click on Edit options.
- Paste in all the Hubl code, from the file you download, into the Hubl field.
- Click Done in the module.
- Click Publish at the top right to publish your template with changes.
4) Locate Your CSS Stylesheet
You’ll now need to modify the CSS stylesheet to position and style your new module. In Hubspot COS, this can get more involved since there are four main ways to add CSS styles. Let’s try to keep this simple and go with the logic that would have come with your original Hubspot theme. But if the structure of your Hubspot COS website has been modified heavily you still can finish this task but you’ll first need to find the best stylesheet to modify.
- Let’s find the CSS stylesheet.
- Still within Design Manager blog template, click on the Edit button at the top left.
- Click on Edit Head to open that dialog.
- If you see a Template Stylesheet, click on that link to open file.
- If you don’t see a Template Stylesheet, follow this path:
- Go to Content > Content Settings.
- Scroll down to the field labeled, Attached Stylesheets.
- If you see one, click on it to automatically open it in Design Manager.
5) Paste in the CSS
You should be veiwing the stylesheet in Design Manager. Hit CTRL/F and search for the blog section. It’s not important where you insert the code but it’s always nice to keep an organized stylesheet.
- Now, perform another search within the stylesheet, this time for the CSS code to make sure it's not there already. Search for any piece of the code, such as, “tabs.” You don’t want to redundantly paste in the code if it's already there. If you can't find it, proceed.
- Before you modify the stylesheet, copy all the text in the stylesheet (CTRL/A) and paste into a text editor and back up the file, saving it as a *.txt file—with that extension.
- Hit Enter a few times to open up a little white space to prepare to paste in the styles from our download.
- Paste in the CSS code.
- Hit Publish Changes.
That’s it! You’re done. If you have trouble, feel free to comment in the form below or contact us. Note that if you have separate templates for blog posts and blog listings you’ll need to add the module (but not the CSS) to the other template.