Coder Social home page Coder Social logo

phrg-a-peek-behind-the-link's Introduction

A Peek Behind the "Link", the Web's Superpower

The Link Is Born

If the web is essentially a way to exchange text, how is it better than books? In addition to being freely accessible and distributable for virtually no cost, texts created on the web can refer to one another, a process that's so common we might miss how special it is. On the Web, HTML documents can organically relate (link) to one another, allowing pieces of information to reference one another without the constraint of a hierarchical structure.

This idea was discovered by Tim Berners-Lee while he was working at European Organization for Nuclear Research (CERN).

A Blueprint for Implementing Links

How can one text reference another text? Let's daydream and figure out the components needed so that one document can refer to another.

Socrates bio

Socrates was a classical Greek philosopher credited as one of the founders of
Western philosophy and is known as the first moral philosopher...

And...

Plato bio
...
Along with his teacher, Socrates (we would like to reference the `Socrates bio` here)...

How can Plato's bio reference Socrates bio?

  1. We need an "address" for the Socrates bio document
  2. We need to have a word or idea suggest "Socrates", a "trigger."

To achieve these two goals we need to describe the data in the document using the same technology ("text") that makes up the document. We need to provide "metadata" โ€” data about data. Below we'll explore Tim Berners-Lee's approach.

How Tim Berners-Lee Solved the Problem

Tim Berners-Lee developed an annotation language named Hypertext Markup Language (HTML). HTML is a language to create content as well as describe the meaning of certain blocks of text.

"Meaning" is denoted by "wrapping" the text in "tags" or built-in content classifications. Each tag broadly defines the marked-up content. Slight variations between usages of a tag can be captured by providing a specific tag with an attribute. These terms might seem abstract, but should become clearer with an example. We could imagine a tag called <telephone> which has attribute location="work" or location="mobile" and which wraps content like (415)555-1212.

Let's move back from the specific to the abstract and take a look at the generalized format of an HTML tag.

Anatomy of an HTML Tag

<opening tag content-attribute=attribute value>
    Content
</closing tag> <!-- its a closing tag because the tag name begins with a '/'. By the way, this is an HTML comment -->

To return to our question, how do we "link" data in HTML?

In our case, we want to describe a link between two pieces of information, Socrates' and Plato's bios. If we were to Google how to define a link with html

Google search result for "How to define a link with HTML

Google provides a good start. From the top result snippet, we learn that:

  1. Use the <a> tag (a type of element) to define a link
  2. Use the href attribute to state where the external data is located

With these instructions, we can translate our generic tag into an <a> tag.

We replace this generic form:

<!-- These are comments  -->
<!-- Generic tag -->
<opening tag content-attribute=attribute value>
    Content
</closing tag>

with:

<!-- Actual link tag -->
<a href='https://en.wikipedia.org/wiki/Socrates'>
    Socrates
</a>

We just used HTML to build a link and express one of the most fundamental features of the web. The ability to relate information to one another.

This simple pattern applies to all HTML elements.

  1. Tags classify the type of data
  2. Attributes describe the specific occurrence of an HTML element

Referring back to our original "Socrates" example.

  1. Universal addresses are called URL (Uniform Resource Locator). We specify the pointed-to resource's address (URL) in an attribute called the href within the markup tag <a>
  2. <a> "wraps" the "trigger" word "Socrates" and denotes the ending of the "wrapping" with its closing tag </a>.

We'll explore actually writing tags more in subsequent sections, so if you feel like you need more practice we'll be revisiting and reviewing these concepts in fine detail in the next section.

Does this need an update?

Please open a GitHub issue or pull-request. Provide a detailed description that explains the issue you have found or the change you are proposing. Then "@" mention your instructor on the issue or pull-request, and send them a link via Connect.

PHRG A Peek Behind the "Link", the Web's Superpower

phrg-a-peek-behind-the-link's People

Contributors

aviflombaum avatar curiositypaths avatar garettarrowood avatar nickwohnhas avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.