Adding external CSS - Blocs adds the CSS file 2x in the header code


#1

So this is weird. I added an external CSS file in the site settings under attachments. For some reason it shows up 2x in the head code:
<link rel=“stylesheet” type=“text/css” href="./css/schroeder-custom-v2.css">

<link rel=“stylesheet” type=“text/css” href="./css/schroeder-custom-v2.css">

Now comes the weird part: this only happens on 1 page in my site. On all other pages the code is only listed 1x in the head. Also: if I remove the CSS file from the attachments in the site settings, BOTH links to the CSS file are removed on the head. If I add it back in, it adds 2 instances of the link.

I even deleted all content on the page in question - didn’t make a difference. The external CSS file is added 2x. I also renamed the CSS file because I though may blocs “got confused” because I added and removed the file from the attachment list. This also had no effect.

This, of course doesn’t affect the page layout/rendering in any way. It’s just a little irritating that when inspecting the code in Google, everything is listed 2x, with 1 instance being overridden.

On a final note: would it make sense to have a category in the forum dedicated to possible bug reporting?

Hang loose,
Gary


#2

This happens sometime when you just including external resources in project. But when you export it again it just shows one. Had couple of times.


#3

unfortunately I’m seeing the 2x entry in my source code after exporting.


#4

I’ve been wanting to know precisely HOW to link to external stylesheets already on my web server. I searched the Blocs forum and found this thread. I’m curious how you even linked your external stylesheet within Blocs. Could you please explain that?

Thanks,

James W.


#5

Hi James,

You want to add it as an external file attachment in the site settings.

Here’s a quick video: https://www.useloom.com/share/ea5aa81463074bdfa2ee1c3613e3fb8f

You can also add external Javascript etc. …


#6

Oh, I know how to add “attachments” but there is no meaning to do that when I have a CSS file already on the server. Adding an attachment would make a duplicate of the file. I merely want to LINK to an existing file. I don’t care to clutter the server with unnecessary duplicate files. So how do I “LINK” to an existing CSS file on my web server from within Blocs?


#7

Not sure if I really understand you, but I don’t think you can link to a CSS file that is already uploaded on a server. You could try adding it in the Project settings under “Analytics Tracking Code”. I found out you can add anything - doesn’ necessarily have to be “tracking code”.

So you could try this:

<link rel=“stylesheet” type=“text/css” href="./folder on server/MyCss.css">


#8

Check that the page doesn’t have this attachment also.

You currently have it set in the project settings, it could also be set on the page too.


#9

Which implies it should perhaps be renamed “Add Code (Analytics Tracking, etc.)”.

Thank you, Gary!

–James W.


#10

No, there are global code input areas to add code for this type of scenario. This analytics input field code gets wrapped in an analytics note (if I remember correctly) so it would make the code misleading if viewed.


#11

This discussion has gotten a little off-topic and doesn’t address the original issue that Blocs is adding the code for the external CSS 2x in the exported HTML. Should I open a support ticket for this?


#12

Did you check page attachments via page settings.


#13

Hi Norm,

I added 1 CSS File in the global site settings under attachments. There are no files attached to any individual pages.