Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,130 --> 00:00:03,240
Now in the last lecture
2
00:00:03,240 --> 00:00:06,360
we added to the _appJS file.
3
00:00:06,360 --> 00:00:09,000
There is an important implication of this.
4
00:00:09,000 --> 00:00:12,297
Now we have to have the element there in appJS
5
00:00:12,297 --> 00:00:14,300
and we of course still also have it
6
00:00:14,300 --> 00:00:15,860
in our page components.
7
00:00:15,860 --> 00:00:17,850
In indexJS in the events folder,
8
00:00:17,850 --> 00:00:20,280
for example, I also have .
9
00:00:20,280 --> 00:00:23,600
And as you see on the rendered page, both is applied.
10
00:00:23,600 --> 00:00:27,050
The title and description from the page component
11
00:00:27,050 --> 00:00:30,830
and the viewport from the _appJS file.
12
00:00:30,830 --> 00:00:32,497
And this is important,
13
00:00:32,497 --> 00:00:37,498
NextJS automatically merges multiple elements.
14
00:00:37,690 --> 00:00:40,440
So if you set a here in _appJS,
15
00:00:40,440 --> 00:00:42,340
and then also in the page component,
16
00:00:42,340 --> 00:00:46,470
the content of those different sections gets merged.
17
00:00:46,470 --> 00:00:49,200
Even if we would have multiple sections here
18
00:00:49,200 --> 00:00:51,210
inside of a single component,
19
00:00:51,210 --> 00:00:54,450
the content would be merged by NextJS.
20
00:00:54,450 --> 00:00:57,920
But of course that means that we could also have conflicts.
21
00:00:57,920 --> 00:01:01,260
For example, I could have a another set here
22
00:01:01,260 --> 00:01:06,000
for whatever reasons, and now I set a here and here.
23
00:01:06,000 --> 00:01:09,690
Now NextJS automatically merges your sections,
24
00:01:09,690 --> 00:01:13,280
and it also resolves such conflicts.
25
00:01:13,280 --> 00:01:17,830
If I add multiple titles here and I reload this Events page,
26
00:01:17,830 --> 00:01:22,113
you see only one title shows up here, not multiple titles.
27
00:01:23,120 --> 00:01:25,610
It simply takes the latest element,
28
00:01:25,610 --> 00:01:28,850
if you have to same element multiple times.
29
00:01:28,850 --> 00:01:31,200
So if we have the here and here,
30
00:01:31,200 --> 00:01:33,100
the second wins.
31
00:01:33,100 --> 00:01:34,920
The same would be true for meta elements
32
00:01:34,920 --> 00:01:37,010
with a name attribute.
33
00:01:37,010 --> 00:01:38,930
If you have other content,
34
00:01:38,930 --> 00:01:40,480
which is neither a title
35
00:01:40,480 --> 00:01:43,640
nor a meta element with the name attribute,
36
00:01:43,640 --> 00:01:47,780
but let's say a meta element with some other attributes,
37
00:01:47,780 --> 00:01:50,723
then you can always add a manual key here,
38
00:01:51,900 --> 00:01:55,340
like description to still allow NextJS
39
00:01:55,340 --> 00:01:58,600
to find out if two elements are clashing.
40
00:01:58,600 --> 00:02:01,550
And then, again, the latter one will win.
41
00:02:01,550 --> 00:02:04,770
Now, of course, this is redundant code here, this extra head
42
00:02:04,770 --> 00:02:08,220
I just wanted to show this NextJS behavior.
43
00:02:08,220 --> 00:02:11,260
And that it does have an important implication
44
00:02:11,260 --> 00:02:15,280
because it means that in _appJS, we can indeed
45
00:02:15,280 --> 00:02:18,030
also go into the head section we set up there,
46
00:02:18,030 --> 00:02:22,110
and define a general title that applies to all pages,
47
00:02:22,110 --> 00:02:24,080
unless it's overwritten.
48
00:02:24,080 --> 00:02:27,470
This ensures that we always have a title on every page,
49
00:02:27,470 --> 00:02:30,530
even if we forget to set a page specific one,
50
00:02:30,530 --> 00:02:33,090
which we, of course, typically want to do.
51
00:02:33,090 --> 00:02:37,140
So here, I'll then give all my pages a general title,
52
00:02:37,140 --> 00:02:41,220
and also a general description.
53
00:02:41,220 --> 00:02:44,730
Again, that will be overwritten by the page specific data,
54
00:02:44,730 --> 00:02:47,550
but in case we don't have page specific data,
55
00:02:47,550 --> 00:02:50,660
then this general data would kick in.
56
00:02:50,660 --> 00:02:53,730
So here I have my general setup,
57
00:02:53,730 --> 00:02:57,090
but if I reload this All Events page,
58
00:02:57,090 --> 00:02:58,780
we don't see that there.
59
00:02:58,780 --> 00:03:01,750
Because we do have page specific data here,
60
00:03:01,750 --> 00:03:06,010
and that then overrides the more general data.
61
00:03:06,010 --> 00:03:08,890
Because the page component is rendered
62
00:03:08,890 --> 00:03:10,260
after the app component.
63
00:03:10,260 --> 00:03:12,200
So the later section wins
64
00:03:12,200 --> 00:03:13,680
and that will be the head section,
65
00:03:13,680 --> 00:03:15,253
instead of the page component.
5198
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.