Hi! I’m making a little portfolio site for my college’s art department, which will ultimately be hosted on the art department’s SFTP server.
The site looks good on localhost:4000, but when I copied the _site folder to the department server, none of the links worked: images weren’t showing up, CSS was missing, and links to other pages were broken.
Putting the site in the root folder of the server seemed to fix the problem, but the issue is that the department has a lot of other sites, so it needs to go in a folder. However, as soon as I put the site in a subfolder, it stops working.
I’ve tried changing the baseurl in the config to the name of the folder, but that didn’t fix the _site files, and broke the links on the local host too.
I’ve been struggling with this issue for about a week, although I’m sure the answer is something really simple that I haven’t noticed. I’m still fairly new to Jekyll, so patience is appreciated!
do you have access to the server to configure it? sounds like you need to tell it the folder is a virtual directory?
If not I would think the baseurl would fix it, you just need to know the correct name for it. When you tried that what did you name the folder? and the baseurl value?
baseurl and setting that up correctly should fix your issues. Though having baseurl: "/your-folder" in _config.yml isn’t enough.
You’ll need to make sure all of your assets (CSS, JS, etc) use the relative_url filter or prepend the paths with {{ site.baseurl }} along with any sort of navigation or pagination links in your theme.
Didn’t look over all your files but I’m seeing href typos like this that aren’t doing you any favors… e.g. you have too many quotes before /css/main.css
Using relative_url is preferred as it has some built in logic to remove/add forward slashes. Which might be your issue too. If you inspect the source of some of the HTML files in _site you should be able to tell quickly if the CSS paths are right.
My guess you’re missing /, have // or missing the subfolder all together.
Thanks for your quick reply! (And sorry for my late one!)
I implemented your suggestions and the site now shows up properly on the local server. However, it still isn’t showing up properly in the _site folder or on the SFTP server. The sources all look good to me when I inspect them in the browser, but still the images and formatting aren’t showing up, and the links don’t work.
On the server, the site is buried in a few different folders: root/library/server/web/etc. Does that have any effect on what my baseurl should be?