Creating files within a container

right now I have all my files as basic html files that I am moving over from a simple git hub folder. The issue comes when I am trying to make one of them a container with more files inside. for example I have a math.html file and everything works perfectly. however when I am trying to create math/exponants.html everything gets screwed up. on the github or even on my computer the way it is set up is I have a math.html file and then I also have a math folder where it contains my exponants.html. any suggestions?

I think I understand your question, but I could be wrong.

In MODX, folders can have content. So a resource can be a folder/container, and still hold the content of a web page.

In Operating systems like iOS, Windows, or Unix (which is used by GitHub), however, something can be a folder, or it can have content, but not both.

My suggestion is to create new folders that are not named for any file (like MathFolder, MathStuff, or something similar). Then, move all the files under the appropriate folder.

Yes, I see that the modx folder can have content but as soon as I make it a container the css no longer works. Sorry I wasn’t specific enough about what was going wrong

How exactly do you link the CSS file from your html file?


Am I correct in assuming, that you created Static Resouces in MODX for these html files?

no I just used a regular document and then I am using content blocks but since I already had these pages made I just used a “html code” field and copied and pasted my html code.

And where is your CSS code?
Is it in a separate file?
How exactly do you link to it in your html code?
When does it work, and what do you before it stops working?

my css file is in the file system under css/style.css. I have it linked like a normal html document would. It works before I make the math document a container but after it doesn’t. I thought maybe changing the source to …/css/style.css would fix it but it didn’t.

EDIT:
I fixed it using the modx minify but then my images were no longer working but I basically did what I tried for the css file with the image and it worked so I assume the css file just didn’t load immediately. so what I learned is that making the document a container makes the file one folder deeper than it was before.

2nd Edit:
I am realizing I most likely could have set it to /css/style.css (with the slash at the beginning)

Thank you

Normally, you would put the CSS inclusion in the head section of the template for that resource. Also, if the template for that resource has an <html> tag in it, adding another one in your resource would cause trouble.

do you have

<base href="[[!++site_url]]" />

like shown here in the documentation?
Integrating Templates - Building Sites | MODX Documentation

2 Likes

thank you for reminding me