4.4. Hosting the API Documentation Website¶
Generating the API documentation is great, but seeing it is even better. You can use the steps provided below to host the generated website using your Odin account. Alternative approaches to the explicit instructions provided below are explored in the FAQ section towards the end of this tutorial.
Ensure that you have a
public_html
directory in your home directory. If the~/public_html
directory does not exist, you should create it. The purpose of this directory on Odin (and on many systems) is to support user websites, which will be illustrated in the following steps. We will focus on API Documentation websites in this course but you could build and host a personal “about me” page using Odin. Please note that you are fully responsible for anything that you host through your Odin website.To make our documentation publicly available on the web, we will set up a symbolic link to the
doc
directory you created in the previous steps. You can think of a symbolic link as a shortcut to those files. The symbolic link will need to be placed in the~/public_html
folder but thedoc
directory you created will not move.The syntax for the command to create a symbolic link is:
ln -s <absolute path to the doc directory> <relative path to the link being created>
Notice that the first path must be an absolute path and that the second path can be a relative path. For example, if I were running the
ln
command from within thecs1302-javadoc
directory that contains mydoc
folder, my command might look something like this:ln -s /absolute/path/to/cs1302-javadoc/doc ~/public_html/cs1302-javadoc-doc
where
/absolute/path/to/cs1302-javadoc/doc
is replaced with the real absolute path todoc
andcs1302-javadoc-doc
is the name of the symbolic link being created. The absolute path required will depend on your username and the name of the link can be anything you like (although we generally recommend using the same names we use in the tutorial). When typing out the absolute path, be sure to use tab completion!Recommended Shortcut (avoid typing the full absolute path)
If you want to avoid typing the absolute path every time, you can try the command below. However, for this command to work properly, it must be executed from the directory that contains the
doc
directory. In this example, the command must be run from thecs1302-javadoc
directory.ln -s $(pwd)/doc ~/public_html/cs1302-javadoc-doc
Understanding the Command
As previously stated, the
ln
command requires the absolute path to our link’s target (in this case,doc
). Since our intended target is in the current directory, we know that its absolute path is the same as the absolute path of the current directory followed by/
followed by the name of our target. We could manually figure out the desired path with the help ofpwd
or we can use$(pwd)
, as seen above, to fill in the output ofpwd
instead. You could also type out the entire absolute path but that would be tedious and error-prone. If you type out the full path, be sure to use tab completion!In this scenario, the symbolic link is called
cs1302-javadoc-doc
. You can see it if you change into yourpublic_html
directory and perform anls -l
. The entry forcs1302-javadoc-doc
in the long listing indicates that the file is a symbolic link in two different ways: i) anl
is prefixed in the mode instead of-
ord
; and ii) the filename lists an arrow pointing to the link target.Navigate to the following URL in your web browser, replacing
user
with your Odin username in the URL below (leave the~
). If you have any trouble viewing your website, see the next section for troubleshooting tips:https://webwork.cs.uga.edu/~user/cs1302-javadoc-doc/
Congratulations! If you followed the steps correctly, then you should see the API documentation website that you generated earlier. If your website did not show up, move on to the next section for some Troubleshooting Tips.
Does this website look similar to any other websites that you may have visited?