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_htmldirectory in your home directory. If the- ~/public_htmldirectory 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 - docdirectory 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_htmlfolder but the- docdirectory 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 - lncommand from within the- cs1302-javadocdirectory that contains my- docfolder, 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/docis replaced with the real absolute path to- docand- cs1302-javadoc-docis 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 - docdirectory. In this example, the command must be run from the- cs1302-javadocdirectory.Listing 4.3 This command will only work if executed within- cs1302-javadoc(the parent folder of- doc).¶- ln -s $(pwd)/doc ~/public_html/cs1302-javadoc-doc - Understanding the Command - As previously stated, the - lncommand 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 of- pwdor we can use- $(pwd), as seen above, to fill in the output of- pwdinstead. 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 your- public_htmldirectory and perform an- ls -l. The entry for- cs1302-javadoc-docin the long listing indicates that the file is a symbolic link in two different ways: i) an- lis prefixed in the mode instead of- -or- d; and ii) the filename lists an arrow pointing to the link target.
- Navigate to the following URL in your web browser, replacing - userwith 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?