Webpage Guide

From UCBMathWiki

Jump to: navigation, search

This page provides a basic tutorial on how to manually create your own web page on the Math department server.

Contents

Setting up a web page

Hello World page

Below is a minimal example of well formed (W3C-compliant) HTML document. It includes a handy HTML markup validation button.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Hello World</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="content-style-type" content="text/css"/>
</head>
<body>
  <p>Hello, World!</p>

  <p>
    <a href="http://validator.w3.org/check?uri=referer"><img
      src="http://www.w3.org/Icons/valid-xhtml10"
      alt="Valid XHTML 1.0 Transitional"
      style="border: 0; height: 31px; width: 88px" /></a>
  </p>
</body>
</html>

Unix command line method

This section explains how to create a webpage from a Unix terminal session, assuming you already know a little of Unix commands and HTML. For an introduction to HTML, see below.

mkdir public_html
chmod 755 public_html
xemacs public_html/index.html

For more information on managing files on the math department's file server and what the permissions mean, see the page on file management.

GUI method

This method works from any Math thin client computer connected to beyonce.math.berkeley.edu. The steps are essentially the same but no knowledge of Unix commands is necessary.

Note: All your changes become visible to the world the moment you save the file. It is not recommended to use this error and try approach with the index.html file. Use a different file instead, e.g. test.html, and rename it to index.html when you are satisfied with changes.

Upload method

This method works from any (non-department) computer. Again, the essential steps are the same but you edit your HTML code on a personal laptop or home computer and upload ready-made web pages to the public_html subdirectory of your Math department home directory.

Note: Here are some popular free SFTP clients: Fugu for Mac, WinSCP for Windows. Linux GNOME environment comes with built-in "Connect to Server" feature as well as an amazing text-based utility called lftp.

Potential problems

Some things which might go wrong when you try to view the page in a browser:

chmod 755 public_html
chmod 644 public_html/index.html

Basic HTML

Each individual webpage on your site corresponds to a file of the form name.html . An HTML file just consists of plain text with a couple commands that tell the browser to do something to the display (for example, make the text bold font). Just like in LaTeX, there are some special characters that tell the browser "I am giving you a command"; they are <, > and /. Every command takes the form <command>, and most commands also allow you to turn them off by typing </command>. For example, if you want to turn on bold font, type <b>. When you are done typing the text that you'd like bold, turn off bold font with </b>.

The nice thing about HTML is that it is very forgiving--even if you make a mistake it will try its best to render something in the browser. This makes it easy to see the mistake and usually makes it easy to see how to fix the mistake too. Commands are case-insensitive.

Learning More HTML

If you come across a web page and want to know how they did that, you can try looking at the webpage's source. Most browsers have a View Source option in their menu (e.g. Firefox has a convenient keyboard shortcut Ctrl-U for source viewing); this will bring up the HTML page which you can examine.

Also, there are many HTML tutorials and reference guides. One tutorial can be found at w3schools.com.

There are also free templates (a.k.a. CSS style sheets) available online. A particularly good site can be found at openwebdesign.org.

Concealing Your Email From Spammers

Spammers use automated programs called webcrawlers to browse through webpages searching for email addresses. If your email address is just written in plain text in the HTML file (especially if you use the mailto command) a webcrawler will pick it up and you will get more spam. There are a few ways to conceal your email address from webcrawlers. We have listed them below, in increasing difficulty of implementation (which also happens to be increasing order of strength).

<script type="text/javascript">
GoFish=new Array()
GoFish[0]="%3c%61%20%68%72%65%66%3d%" + "22%6d%61%69%6c%74%6f%3a"
GoFish[1]="YOUR_NAME_HERE" + "%40%6d%61%74%68%2e%62%65%72%6b%"
GoFish[2]="65%6c%65%79%2e%65%64%75%22%3e" + "YOUR_NAME_HERE"
GoFish[3]="%40%6d%61%74%68%2e%62%65%" + "72%6b%65%6c%65%79%2e%65%6"
GoFish[4]="4%75%3c%2f%61%3e" + ""
OutString="";
for (j=0;j<GoFish.length;j++){
OutString+=GoFish[j];
}document.write(unescape(OutString));
</script>

In the two spots where it says YOUR_NAME_HERE you have to put the hexadecimal code for your user name. This hex generator will output the hexadecimal code for your user name.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox