diff --git a/curriculum/challenges/english/blocks/lecture-working-with-links/671682dd88e461a8e2620f38.md b/curriculum/challenges/english/blocks/lecture-working-with-links/671682dd88e461a8e2620f38.md index bb28c2d24ec..b1deb9b66d1 100644 --- a/curriculum/challenges/english/blocks/lecture-working-with-links/671682dd88e461a8e2620f38.md +++ b/curriculum/challenges/english/blocks/lecture-working-with-links/671682dd88e461a8e2620f38.md @@ -11,17 +11,7 @@ A path is a string that specifies the location of a file or directory in a file An absolute path is a complete link to a resource. It starts from the root directory, includes every other directory, and finally the filename and extension. The "root directory" refers to the top-level directory or folder in a hierarchy. -An absolute path also includes the protocol - which could be `http`, `https`, and `file` and the domain name if the resource is on the web. Here's an example of an absolute path that links to the freeCodeCamp logo: - -```html - - View fCC Logo - -``` - -In this example, the protocol is `https`, the domain name is `design-style-guide.freecodecamp.org`, and the filename is `fcc_secondary_small.svg`. - -Now, what if the resource you want to link to using an absolute path is on your local machine? Here's how to link to the `about.html` file with an absolute path: +If you are linking to a resousce on your local machine, use an absolute path, which includes the full directory location of the file. Here's how to link to the `about.html` file with an absolute path: ```html

@@ -33,7 +23,17 @@ Now, what if the resource you want to link to using an absolute path is on your

``` -It looks like this because we are going into a folder called `Users`, then into a folder called `user`, then into a folder called `Desktop`, then into a folder called `fCC`, then into a folder called `script-code`, then into a folder called `absolute-vs-relative-paths`, then into a folder called `pages` to finally get the `about.html` file. +It looks like this because we are starting from the root and going into a folder called `Users`, then into a folder called `user`, then into a folder called `Desktop`, then into a folder called `fCC`, then into a folder called `script-code`, then into a folder called `absolute-vs-relative-paths`, then into a folder called `pages` to finally get the `about.html` file. + +An absolute URL is a complete address used to access a resource. It includes the protocol - which could be `http`, `https`, and `file` and the domain name if the resource is on the web. Here's an example of an absolute URL that links to the freeCodeCamp logo: + +```html + + View fCC Logo + +``` + +In this example, the protocol is `https`, the domain name is `design-style-guide.freecodecamp.org`, and the filename is `fcc_secondary_small.svg`. Here's what the absolute URL looks like in the browser address bar: @@ -43,6 +43,8 @@ file:///Users/user/Desktop/fCC/script-code/absolute-vs-relative-paths/pages/abou The URL includes the protocol, `file://`. It also includes the path, which looks like this: `/Users/user/Desktop/fCC/script-code/absolute-vs-relative-paths/pages/`, and represents the series of folders that lead to the file. And finally, it also includes the `about.html`, which is the filename and the extension. +An absolute path shows the full location of a file within a file system and is commonly used for resources on a local machine. An absolute URL includes access information - such as the protocol and, for web resources, the domain name - which tells the browser how and where to retrieve the resource. + Now, lets look at the relative path. A relative path specifies the location of a file relative to the directory of the current file. It does not include the protocol or the domain name, making it shorter and more flexible for internal links within the same website. Here's an example of linking to the `about.html` page from the `contact.html` page, both of which are in the same folder: ```html @@ -54,11 +56,11 @@ Now, lets look at the relative path. A relative path specifies the location of a So imagine you are on the `contact.html` page, and because the `about.html` page is in the same place, you simply get the filename. This is an example of using a relative file path. -So, which should you use and when; an absolute path or a relative path? Here are the rules you should follow: +So, which should you use and when; an absolute path, an absolute URL or a relative path? Here are the rules you should follow: -- Use absolute paths when linking to a resource hosted on an external website. +- Use absolute paths when you want to reference a resource from a fixed location, such as from the root of your site or a known directory on your local machine. -- Use absolute paths when you need the link to a page or resource to work consistently regardless of the document location within the site. +- Use absolute URL when linking to a resource hosted on an external website. - Use relative paths when linking to resources within the same website. @@ -110,8 +112,16 @@ How do you link to a resource available only on the internet? ## --answers-- +Absolute URL. + +--- + Absolute path. +### --feedback-- + +Think about the path that has to have an `http` or `https` protocol. + --- Relative path. @@ -128,21 +138,13 @@ Both relative and absolute paths. Think about the path that has to have an `http` or `https` protocol. ---- - -None of the above. - -### --feedback-- - -Think about the path that has to have an `http` or `https` protocol. - ## --video-solution-- 1 ## --text-- -Which protocol is used for an absolute path on a local machine? +Which protocol is used for an absolute URL on a local machine? ## --answers--