Uploading work to your server via Cyberduck is mostly relatively straightforward, but there are a few wrinkles to note and learn.
- Files placed in the public_html folder show up in the root of your domain. That is, placing testfile.html in your public_html folder means that file can be accessed at yoursite.com/testfile.html
- Similarly, folders placed in public_html become directories in your URL. If you create a folder called assignment-one in public_html and then place testfile.html inside of it, the URL for that file will be yoursite.com/assignment-one/testfile.html
- Don’t include any spaces in the names of files you place on your server.
- Use all lowercase letters in your filenames. Domain names aren’t case sensitive (that is apple.com, Apple.com, APPle.com, applE.com all work), but folder and file names are (that is, apple.com/mac will take you to a valid page, but apple.com/MAC will not).
- Additionally, name your files semantically—give them descriptive names, and separate multiple words with dashes. For example, page1.html is not a very good name. page-one.html is better. go-dawgs.html (or some other name reflecting the content of this page) is best.
In this class, all files for a given assignment should live in a single folder named assignment-one, assignment-two, etc. so that we can go to any student’s site and type yoursite.com/assignment-one and arrive at your page.
Additionally, the main page for each assignment should be named index.html (this is the only “magic” filename in that web browsers, when pointed to a folder, will automatically look for and load a page named index.html). 1
Each assignment folder should contain all of your html files in its root. It should also contain each of the following folders, with the attendant files logically organized:
This is a common organizational structure on the web. Once you’re more experienced, you can bend and tweak this setup, but use it for every assignment for this class. Put all media files (audio, movies, etc.) in your img folder.
For the first two assignments, a great workflow is to do all development locally (on your lab iMac / personal laptop) then upload your files to the server when they’re done. To upload using Cyberduck, simply open Cyberduck and click on your site’s bookmark. Navigate to your site’s public_html folder, and then drag and drop your entire assignment folder (assignment-one, etc.) into the Cyberduck window. Once the upload is complete, you can now access your work at yoursite.com/assignment-one!
Once your work is uploaded to your server, you can make changes in two ways.
First, you can continue to work on the files on your local machine and then upload them when you’re done. If this works for you, go for it! The main benefit is that you can noodle around in private and then make your work publicly visible only when you’re ready. That is, there’s no auto-syncing between the files on your local machine and those on your server.
The second option works only if you’ve made Brackets the default editor in Cyberduck (to do so, go to the menu bar and select Cyberduck > Preferences or hit ⌘ + , and select Editor (the pencil icon), click the dropdown menu, click Choose…, select Brackets, and be sure to check the box for “Always use this application.”
Once you’ve done that, you can click on any file in Cyberduck and click “Edit.” Make your changes, then hit save and wait for the “Upload Complete” notification—your changes are now live on your site!
There are, however, two perils with this method. The first is that you’re editing your site live, with no backup. Accidentally delete something, and it’s gone forever. Write some great code or content, but then there’s an issue with your server, and again, gone forever. Also, you’re working in public. Right now, your site likely doesn’t have much traffic, but it’s something to be cognizant of.
The second peril is more real, and you need to understand the way Cyberduck achieves the magic of editing files live on your server with Brackets to understand why. When you click edit, Cyberduck downloads a temporary working copy of the file you’ve chosen to edit and saves it to your computer in a cache folder (a randomly named folder that exists just for this type of thing). Then, when you click save, it uploads the edited cached copy back to your server.
The place where this can bite you is this: if you use this method, but then fail to close the cached / temporary copy in Brackets and disconnect from the server, Brackets will still show you this file even though Cyberduck no longer holds any association between it and the file on your server. It’s not uncommon for students to work in a non-associated cached copy and not understand why their site is updating. This can get messy quickly, but thankfully, it has an easy solution: always close the cached copy of anything you’re “editing” in Brackets through Cyberduck.
And yes, I know this breaks the semantic naming rule I just mentioned.↩