Module 4: Hyperlinks

Creating an Index File

An index file in the context of a website refers to a specific file that serves as the default or landing page for a web directory or folder. It's also commonly known as the "default document" or "home page." When a user accesses a directory on a web server, the web server looks for an index file within that directory and, if found, displays it as the initial webpage for that directory. If no index file is present, the server may either show a directory listing (if configured to do so) or return an error.

Here's a more detailed explanation of index files and why they are important:

  • Default Page: Index files are important because they serve as the default page that a web server displays when a user accesses a directory without specifying a particular file. For example, if you type "www.example.com" into your web browser, it may actually be requesting "www.example.com/index.html" or another designated index file.
  • Uniform Resource Locator (URL): Index files are also used to create cleaner and more user-friendly URLs. Instead of showing a long and complex URL with multiple directory levels, a well-configured website will use index files to provide users with a cleaner and more concise URL. For example, "www.example.com/products/" can be configured to display the index file in the "products" directory without explicitly showing "www.example.com/products/index.html."
  • Hierarchy and Organization: Index files help maintain a hierarchical structure for organizing a website's content. By defining a default file for each directory, web developers can control how the site's information is presented and make it easier for users to navigate.
  • Search Engine Optimization (SEO): Properly configured index files can impact a website's SEO. Search engines use index files to understand the structure and content of a website. Having well-organized and user-friendly URLs can positively affect a website's search engine ranking.
  • Customization: Webmasters and developers can customize the content of index files to create landing pages or introductory content for specific sections of a website. This allows for a tailored user experience and can be used for branding, promotions, or important announcements.

Common index file names include "index.html," "index.php," "index.htm," and "default.htm," depending on the web server's configuration and the technology used to build the website.

In summary, index files are a fundamental part of web development that helps organize website content, create user-friendly URLs, and ensure a seamless user experience. They are important for both user navigation and search engine optimization, making them a crucial element in the structure and functionality of a website.



Hyperlinks: Navigating the Web of Information

Hyperlinks, often referred to simply as "links," are the connective tissue of the internet. They are the digital pathways that enable users to traverse the vast landscape of information available on the World Wide Web. Hyperlinks are the foundation of the web's interconnected nature, allowing users to seamlessly jump from one piece of content to another with a single click.

How Hyperlinks Work:

At its core, a hyperlink is a reference within a digital document that points to another resource, often a web page. This reference is embedded in text, images, buttons, or other elements on a web page. When a user interacts with the hyperlink, typically by clicking on it, the web browser interprets the link and requests the linked resource from the server hosting it. The server then sends the requested content back to the user's browser, which displays it on the screen.

Components of a Hyperlink:

Anchor Text: This is the visible and clickable part of the hyperlink. It's usually a highlighted word or phrase that gives users an idea of where the link will take them. For example, in the phrase "Read more about space exploration," the words "Read more about space exploration" serve as the anchor text.

URL (Uniform Resource Locator): The URL is the actual web address of the linked resource. It specifies the protocol (such as "http" or "https") and the domain name (like "example.com"). The complete URL directs the browser to the specific web page, image, video, or other content.

Types of Hyperlinks:

Text Links: These are hyperlinks embedded within text. For instance, in a blog post discussing cooking techniques, the words "oven-baked recipes" might be a text link pointing to a collection of such recipes.

Image Links: Hyperlinks can also be applied to images. A product image on an online store's webpage might be a link that takes users to the detailed product page.

Button Links: Buttons designed to resemble interactive elements can also be hyperlinks. A "Learn More" button on a homepage might link to an informative article or section.

Examples of Hyperlinks:

Wikipedia: In an article about the Eiffel Tower, there could be a hyperlink on the words "Gustave Eiffel" that directs users to a biography of the tower's designer.

News Websites: An article discussing a scientific discovery might have a hyperlink on the phrase "recent study" that leads to the full research paper.

Online Shopping: On an e-commerce site, a product listing for a laptop might feature a hyperlink on the words "customer reviews" that navigates users to reviews from buyers.

Social Media: On a social media platform, a post about a vacation might include a hyperlink on the phrase "beach paradise" that takes users to a photo album of the vacation.

Educational Resources: In an online course, a lesson on World War II might have a hyperlink on the term "Pearl Harbor" that directs students to a multimedia presentation about the event.

Hyperlinks empower users to explore the internet in a non-linear way, making the web a dynamic, interactive space where knowledge is just a click away. They facilitate the discovery of new information, enable seamless navigation, and are the backbone of online resources, providing a powerful tool for sharing and connecting content across the digital realm.



The History of Hyperlinks

1960s - Hypertext Concepts Emergence:

In the 1960s, visionaries like Ted Nelson, Douglas Engelbart, and Andries van Dam laid the groundwork for the concept of hypertext. They explored the idea of organizing information in a non-linear manner, allowing users to navigate between interconnected pieces of text. Ted Nelson coined the term "hypertext" in 1963 to describe this system of textual links.

1965 - Ted Nelson's "Xanadu" Project:

Ted Nelson envisioned a complex hypertext system called "Xanadu," aiming to create a global network of interconnected documents. His ambitious project proposed bi-directional links, enabling seamless navigation between documents. Additionally, Nelson's ideas included addressing copyright and compensation for content creators, concepts that have yet to be fully realized even in today's internet landscape.

1968 - "Mother of All Demos":

Douglas Engelbart's groundbreaking demonstration in 1968 showcased the potential of computers for collaboration and information sharing. Although not directly focused on hyperlinks, this event introduced the mouse and graphical user interface, concepts that would later facilitate user-friendly interactions with hyperlinked content.

1980s - HyperCard and Envisioning the Hyperlink:

Apple's HyperCard software, released in 1987, brought hypertext concepts to personal computers. HyperCard allowed users to create "stacks" of digital cards, each containing text and graphics, interconnected via hyperlinks. Although HyperCard was isolated from the internet, it introduced the notion of a clickable link and demonstrated the potential for non-linear content presentation.

1989 - Tim Berners-Lee's Proposal:

Tim Berners-Lee's proposal for a "distributed information system" laid the foundation for the World Wide Web. His vision involved using hypertext to link documents across the global network. He developed the necessary technologies, such as the HyperText Transfer Protocol (HTTP), Uniform Resource Locators (URLs), and HyperText Markup Language (HTML), to enable the creation of interconnected web pages.

1990 - WorldWideWeb Browser:

In 1990, Tim Berners-Lee created the first web browser, WorldWideWeb (later renamed Nexus), to view and create web pages. This browser allowed users to create basic hyperlinks by manually entering URLs and specifying links between documents. It served as a prototype for web browsing and demonstrated the concept of hyperlinking on the World Wide Web.

1993 - Mosaic Browser and Graphical Links:

The release of the Mosaic web browser in 1993 marked a significant advancement in web browsing. Mosaic supported displaying images alongside text, making the browsing experience more visually engaging. The browser's interface also introduced clickable graphical buttons for navigating hyperlinks, enhancing user interaction and setting the stage for more intuitive navigation.

1993 - Introduction of HTML Anchor Tags:

With the introduction of HTML anchor tags (<a>) in 1993, web authors gained a standardized way to create hyperlinks. These tags allowed authors to specify the destination URL and the anchor text visible to users. This innovation simplified the creation of hyperlinks and contributed to the web's rapid expansion.

1994 - Netscape Navigator:

Netscape Navigator, released in 1994, played a pivotal role in popularizing the World Wide Web. It supported more advanced HTML features, including images and forms, and introduced JavaScript for interactive web elements. This browser's widespread adoption accelerated the growth of the web and the use of hyperlinks.

Late 1990s - Link Styling and CSS:

In the late 1990s, the introduction of Cascading Style Sheets (CSS) allowed web designers to separate content from presentation. This separation included the ability to style hyperlinks differently from regular text. Designers could change hyperlink colors, underlines, and hover effects, enhancing the visual distinction of clickable links.

Early 2000s - Deep Linking and Legal Issues:

As websites became more complex, the practice of deep linking—linking directly to specific pages within a website—gained attention. Legal concerns arose as some website owners opposed deep linking, claiming copyright infringement. This led to debates about the nature of online linking and the rights of content creators in the digital age.

Modern Era - Hyperlink Evolution:

Hyperlinks have continued to evolve alongside web technologies. Rich media embedding, such as linking to videos or interactive content, became possible, enhancing the diversity of linked content. Additionally, anchor-based scrolling allows users to navigate to specific sections within a single web page, providing a smoother and more focused browsing experience.

Today - Hyperlinks in Various Formats:

Hyperlinks have transcended traditional web content and are now integral to various forms of digital communication. In emails, documents, and even mobile apps, hyperlinks provide a means of accessing external information. They are used not only for linking to websites but also for referencing specific sections in lengthy documents and creating interactive user experiences within applications.

Throughout its history, the hyperlink has been a fundamental building block of the World Wide Web, enabling the seamless interconnectedness of information and shaping the way we navigate and interact with digital content.



Video: Types of Hyperlinks



The Anchor Tag

In HTML, the anchor tag <a> is a fundamental element used to create hyperlinks, allowing you to connect different web pages, documents, or resources together. The anchor tag serves as the bridge that lets users navigate between various parts of a website or jump to external content. It consists of two main components: the anchor text and the hyperlink reference.

Components of the Anchor Tag:

  • Anchor Text: This is the visible and clickable part of the hyperlink that users interact with. It's the text that provides context about where the link will take them.
  • Hyperlink Reference (URL): The hyperlink reference, commonly known as the URL, is the web address that the anchor tag points to. It can be an absolute URL (starting with "http://" or "https://") or a relative URL (a path within the same website).

Usage and Syntax:

The basic syntax of an anchor tag is as follows:

<a href="URL">Anchor Text</a>

Here's what each part of the syntax represents:

href: This attribute specifies the destination URL. It can be an absolute or relative URL. “href” stands for “hypertext reference”.
Anchor Text: This is the text that users see and click on. It provides context about the link's purpose.

Examples of Anchor Tags:

Basic External Link:

To create a link to an external website, you would use an absolute URL as the href attribute. For example:

<a href="https://www.example.com">Visit Example Website</a>

Relative Link:

When linking to a page within the same website, you can use a relative URL. If the page you're linking to is in the same directory, you can use just the filename. If it's in a subdirectory, include the path:

<a href="about.html">Learn About Us</a>
<a href="products/laptops.html">Explore Laptops</a>

Linking to an Email Address:

You can create links that open the user's default email client with a pre-filled email. Use the mailto: scheme in the href attribute:

<a href="mailto:contact@example.com">Send us an Email</a>

Linking to a Specific Section within a Page:

To link to a specific section within a page, you can use an anchor in the href attribute. The target section needs an id attribute:

<a href="#section-id">Jump to Section</a>
<!-- ... -->
<section id="section-id">
<!-- Section content -->
</section>

Opening Links in a New Tab/Window:

By adding the target="_blank" attribute, you can make the link open in a new browser tab or window:

<a href="https://www.example.com" target="_blank">Visit Example Website</a>

These examples showcase the versatility of the anchor tag in HTML. Whether you're connecting pages within your own website or linking to external resources, the anchor tag is the key to creating interconnected content on the web.

Videos for Module 4: Hyperlinks

There are no videos yet this term for this Module. Check back soon!

Activities for this Module

S4 - Cloud Hyperlinks

Note: Sandbox assignments are designed to be formative activities that are somewhat open-ended. To get the most value, spend some time playing around as you code.

In this Sandbox, we will be creating a few different kids of links using some existing code as a starting point.

Open the , and copy/paste the entire code into , replacing the default code in the HTML pane.

Internal Links

The first link has already been done for you. It is called an “internal” link, because it links to a place in the same HTML page.  This is the code that makes up the link:

<a href="#cumulus">Cumulus</a>

The HTML tag for making links is the anchor tag, or a.  The href attribute tells the link where it is linking to.  In this case, it is linking to an element on the same page with an id cumulus.  We know this, because the #cumulus selector starts with #, which indicates an id attribute. If you look just down the page, you can see the h2 element with the id of cumulus:

<h2 id="cumulus">Cumulus Clouds</h2>

Try clicking the Cumulus link in the preview pane.  You’ll notice that the h2 containing “Cumulus Clouds” moves to the top of the preview window.

Make similar links for the other types of clouds listed to their corresponding h2 elements below. Don’t forget that you need to both add the id attribute to the h2 tags, and also create the links near the top.

Links to Other Web Pages

Now that you know what a link looks like, with the link destination in the href attribute and the link text contained between the opening anchor tag <a> and the closing anchor tag </a>, let’s try a practice link.  The following would display the link text “Bill’s Web Site” and upon clicking, it would take you to “http://www.bmoseley.com”:

<a href=“http://www.bmoseley.com">Bill's Web Site</a>

Notice that when we are linking to a web page on a different server, we need to include the whole address, including the http:// part. Leaving this out will cause the link to not work properly.  If you want to be sure you have the right address, an easy way to create the link is to navigate to the page you would like to link to, and copy/paste the address right from the address bar in your browser to the href attribute in your code.  Don’t forget to surround the address in quotes. (All attribute values should be surrounded by quotes, even though at times the code might work without them).

On line 17 of the code, you will see the following:

<p>Source: https://scijinks.gov/clouds/</p>

Add an anchor tag that turns that web address into a clickable link that takes the user to the web page.

Email Links

Have you ever clicked on a link that says something like “Email Me”, and instead of going to a web page it opens up a blank email message with the web address filled in? Let’s take the following line in the code, and turn it into an email link:

<p>Email for More info: mail@allaboutclouds.com</p>

To do this, instead of a web address in the href attribute, you will put the following:

<p>Email for More info: <a href="mailto:mail@allaboutclouds.com">mail@allaboutclouds.com</a></p>

If you want to spend a little bit of time adding some CSS to this code, go for it.  When you’re done, screenshot the Liveweave window and upload it to the discussion for Sandbox S4.

Post the following:

  1. You can post screenshots of your code or the results of your code when it is run.
  2. Something you learned from this.
  3. Something you struggled with or found difficult.

Please return to this discussion throughout the module, and see if you can either learn from your classmates' work or help them develop their understanding. While I don't count posts, I expect each of you to post your Sandbox Challenge and reply to about 1 classmate per module.

A4 - Index Page with Links

The Challenge

Use what you have learned about hyperlinks to create a main page of your web site.  Instead of naming the file a3.html, name it index.html (Refer to this week's reading for more information on why we do this).  This will ensure that this file is the file users would see if they go to the root folder of your web site.  This page should include a heading of some sort, as well as places to link to all of your other assignments (you can link A1-A3 now, and have some text without links for A5-A16).

This page should also include a "My favorite web sites" section, that has links to 3 or more of your favorite web sites.

Constraints

  • File should be named index.html.
  • Links to A1, A2, A3 and all web sites should be fully functional.

Grading / Success Criteria

To earn credit for this assignment, it must conform to the following:

  • Your file must be named index.html and be uploaded to your web server.
  • You must include functional links to your existing assignments.
  • You must include space to link to future assignments in this class.
  • You must include links to at least 3 other web sites.