Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,005 --> 00:00:04,000
- Absolute URLs are just one way to form a link.
2
00:00:04,000 --> 00:00:06,006
Instead, whenever we are linking to something
3
00:00:06,006 --> 00:00:09,005
that's on the same site, in the same domain name
4
00:00:09,005 --> 00:00:12,001
as the page that has the link,
5
00:00:12,001 --> 00:00:16,000
we can use what's called a relative URL.
6
00:00:16,000 --> 00:00:18,007
Let's imagine we're building a big website.
7
00:00:18,007 --> 00:00:20,008
Eventually we're going to launch this site
8
00:00:20,008 --> 00:00:23,004
at http://www.awesomedogs.com
9
00:00:23,004 --> 00:00:26,007
but meanwhile I'm working on a copy of the site
10
00:00:26,007 --> 00:00:30,005
on my local computer, adding a menu bar.
11
00:00:30,005 --> 00:00:32,008
Later, we're going to put copies of the site
12
00:00:32,008 --> 00:00:36,001
on different servers with different URLs
13
00:00:36,001 --> 00:00:38,005
for testing and review.
14
00:00:38,005 --> 00:00:42,000
If you use the absolute URL for all the links,
15
00:00:42,000 --> 00:00:45,003
the browser will keep trying to get to the pages or files
16
00:00:45,003 --> 00:00:48,001
at http://www.awesomedogs.com, we don't want that.
17
00:00:48,001 --> 00:00:51,001
When I'm working locally, I want all the links
18
00:00:51,001 --> 00:00:54,003
to connect to the local copy of the files.
19
00:00:54,003 --> 00:00:57,001
When you put a copy of the site on a testing server,
20
00:00:57,001 --> 00:01:00,001
you want all the links to point at pages
21
00:01:00,001 --> 00:01:02,005
and files on the testing server.
22
00:01:02,005 --> 00:01:05,007
We want a way to leave out the http://www.awesomedogs.com
23
00:01:05,007 --> 00:01:08,005
part of the URL and have the browser still know
24
00:01:08,005 --> 00:01:11,006
where to find the files.
25
00:01:11,006 --> 00:01:16,004
Creating a relative URL isn't just useful for the A element,
26
00:01:16,004 --> 00:01:18,008
this is a skill we'll use to point to image files,
27
00:01:18,008 --> 00:01:22,007
video files, CSS, JavaScript files, any time we need
28
00:01:22,007 --> 00:01:25,006
to specify a path to a file.
29
00:01:25,006 --> 00:01:30,006
So how do we form a URL from scratch?
30
00:01:30,006 --> 00:01:34,006
Well you need to understand how our files are organized.
31
00:01:34,006 --> 00:01:38,000
There are a bunch of files, organized into a bunch
32
00:01:38,000 --> 00:01:40,003
of directories or folders.
33
00:01:40,003 --> 00:01:43,006
If we want to link to the blog post from March 9th,
34
00:01:43,006 --> 00:01:47,000
we want to say, look inside the folder name blog,
35
00:01:47,000 --> 00:01:51,006
and find the folder named March-9.html.
36
00:01:51,006 --> 00:01:55,005
Filenames have an extension like .html or .jpg,
37
00:01:55,005 --> 00:01:59,002
.css, .js, folder names just have names,
38
00:01:59,002 --> 00:02:02,001
like blog or people, no extension.
39
00:02:02,001 --> 00:02:05,009
The slashes in a URL mean, look inside there,
40
00:02:05,009 --> 00:02:07,009
or go one level deeper.
41
00:02:07,009 --> 00:02:11,002
To create a relative URL we leave off the domain name,
42
00:02:11,002 --> 00:02:14,009
but we include the initial slash at the very beginning.
43
00:02:14,009 --> 00:02:17,002
That tells the browser, go to the root level
44
00:02:17,002 --> 00:02:20,004
of the file structure, the outermost top level
45
00:02:20,004 --> 00:02:24,002
and start from there, or we can write the path
46
00:02:24,002 --> 00:02:28,008
to be relative from the file in which the link is written.
47
00:02:28,008 --> 00:02:31,000
For example, the styles.css file is
48
00:02:31,000 --> 00:02:34,005
in a directory named CSS.
49
00:02:34,005 --> 00:02:37,009
Let's imagine we want to put a link in our CSS file
50
00:02:37,009 --> 00:02:41,002
that points to the logo.gif file,
51
00:02:41,002 --> 00:02:43,000
which is in the images folder.
52
00:02:43,000 --> 00:02:47,001
We could write /images/logo.gif,
53
00:02:47,001 --> 00:02:52,002
or we could write ../images/logo.gif.
54
00:02:52,002 --> 00:02:55,002
The first version creates a URL that's relative
55
00:02:55,002 --> 00:02:56,007
to the root level.
56
00:02:56,007 --> 00:02:59,005
The second version creates a URL that's relative
57
00:02:59,005 --> 00:03:02,009
to the file where the URL is typed out.
58
00:03:02,009 --> 00:03:06,000
The dot dot slash means go up a level.
59
00:03:06,000 --> 00:03:09,007
This whole path means go from where we are now,
60
00:03:09,007 --> 00:03:13,000
up one level, find the folder named images,
61
00:03:13,000 --> 00:03:17,002
and then look inside there for the file logo.gif.
62
00:03:17,002 --> 00:03:20,003
One more thing about URLs relative or absolute.
63
00:03:20,003 --> 00:03:23,008
This URL, http://www.awesomedogs.com/people
64
00:03:23,008 --> 00:03:25,008
is actually looking for a file
65
00:03:25,008 --> 00:03:29,008
at http://www.awesomedogs.com/people/index.html.
66
00:03:29,008 --> 00:03:31,007
People is a folder,
67
00:03:31,007 --> 00:03:35,008
and the URL http://www.awesomedogs.com/people points
68
00:03:35,008 --> 00:03:37,002
to a folder.
69
00:03:37,002 --> 00:03:40,006
Anytime the browser is told to go to a URL
70
00:03:40,006 --> 00:03:43,009
that is folder, it automatically looks
71
00:03:43,009 --> 00:03:47,003
for an index.html file and loads it.
72
00:03:47,003 --> 00:03:50,002
Index.html is a special file name.
73
00:03:50,002 --> 00:03:53,005
This gives us a way to make our URLs pretty or clean
74
00:03:53,005 --> 00:03:57,003
instead of creating file named people.html,
75
00:03:57,003 --> 00:03:59,005
we can create a folder called people,
76
00:03:59,005 --> 00:04:04,003
and inside that folder we put a file named index.html.
77
00:04:04,003 --> 00:04:07,003
This trick only works for HTML files,
78
00:04:07,003 --> 00:04:08,001
not other files.
79
00:04:08,001 --> 00:04:11,004
You don't want to do this with images or CSS.
80
00:04:11,004 --> 00:04:13,005
It also doesn't matter whether you include
81
00:04:13,005 --> 00:04:16,002
that trailing slash or not in a URL
82
00:04:16,002 --> 00:04:18,007
which means that these three URLs
83
00:04:18,007 --> 00:04:22,003
go to exactly the same place.
84
00:04:22,003 --> 00:04:25,002
Making a well structured, elegant URL
85
00:04:25,002 --> 00:04:27,008
to our webpages is an art.
86
00:04:27,008 --> 00:04:29,000
It's worth thinking about
87
00:04:29,000 --> 00:04:31,009
how your URLs effect user experience
88
00:04:31,009 --> 00:04:34,004
and search engine results, and craft them,
89
00:04:34,004 --> 00:04:37,001
the way that you create any content.
90
00:04:37,001 --> 00:04:40,003
Using relative URLs can be super helpful
91
00:04:40,003 --> 00:04:42,008
on a project that moves from server to server
92
00:04:42,008 --> 00:04:45,000
while it's being worked on.
6923
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.