So I have a big local CSS file. This CSS files includes lots of references to background images and such. These are all hard-coded in the file as relative paths.
I have replicated the file structure inside HubSpot. However, these relative paths do not work and the images do not appear.
This is a project under development so the code is changing daily, thus it is not feasible to go in and manually change the image references everytime a new CSS file is provided.
Is there a way to have these relative image paths be understood by Hubspot?
@A2mun no, hubspot automatically adds the "hubfs" to the beginning of all your files. If you want the relative paths to work so you can work locally and push to the server without any hiccups, you'd want to create the hubfs folder in your local environment. If you don't need a local environment, then all you need to do in your CSS file is add the "/hubfs/" to the beginning of all your image/font urls.
@A2mun You need to mimic HubSpot's file manager structure. Create a "hubfs" folder in the root of your site and add all your images in there. Then you can use relative urls locally and should work once it's pushed live - e.g.: "/hubfs/filename.jpg" or "/hubfs/example-folder/filename.jpg"
I have inherited this project and am just getting familiar with Hubspot. So far all I am creating are designs and web pages. How can I create a new website for my project (which is what they said they wanted)?
Then in this new site folder, I will follow your structure and see what happens.
Currently, I am just creating new design templates and then the image is put in a folder in the file manager.
Hi, I have looked into the courses and am comfortable navigating the editor. I'm just unsure how to create a new site where the pages should live. I did it on my personal account but am working through a company account now.
@A2mun Once you've built out the templates, then you should create the pages in the "Content > Site Pages" or under "Content > Landing Pages" - this is where they live if you will.
Okay, so I have figured out how to add a new site - just added a new domain for categorization.
I am still unsure what you mean by adding the hubfs folder to the root of the site though. Currently the files are added through file manager. Do you mean that I should create a hubfs folder there?
@A2mun no, hubspot automatically adds the "hubfs" to the beginning of all your files. If you want the relative paths to work so you can work locally and push to the server without any hiccups, you'd want to create the hubfs folder in your local environment. If you don't need a local environment, then all you need to do in your CSS file is add the "/hubfs/" to the beginning of all your image/font urls.
@A2mun any static files that you want to reference you can just continue using the relative path. But you have to make sure to add the "/hubfs/" to the beginning of it. If you add the "hubfs" folder to your local environment, you'll just want to make sure that that folder doesn't get uploaded to hubspot. if that makes sense
@A2mun I recommend using a root relative url with the slash at the beginning like so "/hubfs/img/assets/footer/flare_line_footer.png"
Also, just make sure you are syncing your local "hubfs" folder to the root of the HubSpot file manager. If you're using FTP to do this then you need to sync it to "/portals/xxxxxxx-portalname/content/files/" - hope this helps!