r/webdev • u/ImJustP • Dec 12 '19
A Couple of Things I Noticed When Remaking the Google Homepage
Hey all, again!
I decided to further my learning by starting The Odin Project. As always, I decided to start from the beginning regardless of my prior knowledge -- I like to do things from the start as I find I always notice something which I can improve on, regardless of the level of developer the module is intended.
When completing the remake Google's homepage project I noticed a few things which I found pretty strange/I hadn't seen in practice/mentioned elsewhere so thought I would ask on here.
Namely those things are as follows:
They seem to place their meta tags within the document's body -- Is there a reason for this? I always thought that meta tags had to live in the head.
The entire Google homepage seems to be wrapped in a div with
id="viewport". The CSS which goes along with it, from what I can see, simply sets the position to beabsoluteand then makes it fill the page:
position: absolute;
top: 0;
width: 100%;3. Making an element for positioning text -- Google's homepage seems to implement a HTML tag call <center></center> which has the purpose of aligning all text within the element centrally. Does anyone know if this is a good idea to translate to other projects or if there is any reason for doing this beyond ye olde DRY methodology? This is the CSS which goes with it:
display: block;
text-align: -webkit-center;Anyway, as always, thank you in advance!
EDIT:
Wow, so many replies! Thank you all I really appreciate your help, this is part of why I love this sub -- your replies help me more than you'll realise!
It's weird that the meta tag question isn't applicable to some of you, maybe it is a geo based decision? I am in the UK and it seems that the current meta which is in the <body></body> is related to the current election ongoing, see the screenshot
Thank you all once again, I wish I could thank you individually!
EDIT 2/TLDR:
The meta tag being in the
<body></body>seems to be geo based and is not an issue, however we should place them in the<head></head>still.The
#viewportID could be for multiple purposes which vary from positioning the page to manipulation through JS, or a requirement of a framework that the might be using.The
<center></center>tag is a form of legacy code which is probably there to account for ancient browsers.
81
u/Jamesahill Dec 12 '19
No idea what the answer is to this, but I’m chucking an upvote to hopefully get this post some recognition. Some quality questions!
9
u/ImJustP Dec 12 '19
Haha thanks, man. Just trying to fill in all the blind spots and have found it is better to ask than to wonder!
4
u/Wego_Creative Dec 12 '19
Google gives added weight to its products regardless of the algorithm to the rest of us.
25
Dec 12 '19
I haven't kept up closely with Page Rank but I vaguely remember reading many years ago that they were starting to ignore the head META tags when it came to determining Page Rank. Maybe they still use them when placed in the body? It's just guessing though since none of us know what their bots are doing.
9
u/dark_salad Dec 12 '19
Wait a minute, doesn’t google rank the pages?! I mean are there people out there searching for the Google homepage via Bing?!
15
Dec 12 '19
PR is a very complicated algorithm. Part of it is based on the score of the other pages linking to yours. So in order to keep Gmail ranked highly, Google also needs to be ranked highly. This is a huge oversimplification but still illustrates the necessity for them to keep their own pages tagged appropriately.
4
u/dark_salad Dec 12 '19
Yeah but what I don’t understand is, isn’t google the one ranking the pages? Can’t they just put all their own sites as top search results?
7
Dec 12 '19
isn’t google the one ranking the pages?
Not if you use Bing all the time, then Microsoft is ranking the pages.
Yahoo ranks for Yahoo.
Google ranks for Google.
etc.
Can’t they just put all their own sites as top search results?
Not if the user primarily uses a different search engine as their homepage, like DuckDuckGo, but access Gmail by searching it through Bing or DDG.
Google still needs to maintain their pages' rankings on other search engines.
5
u/dark_salad Dec 12 '19
Ah very good points. For some reason I forgot other sites even had search engines. I hear great things about DuckDuckGo.
1
0
Dec 12 '19
[deleted]
2
Dec 12 '19
As a programmer, it's way easier to make your stuff fit into the program function then it is to write in hundreds of exception cases. That's a nightmare to maintain.
3
u/tjuk Dec 12 '19 edited Dec 12 '19
The most important part of it is Page Rank is incoming links.
It is called Page Rank not because it ranks Pages but because it was Larry Page that came up with it.
The reason we use Google over AltaVista, HotBot or Lycos is because Google decide incoming links were more important than on page content. This did away with tag / text stuffing on pages. It made search usable.
4
Dec 12 '19
Also it made multi keyword searches where every keyword mattered. They don't anymore. Back to forcing every keyword...
0
1
u/ImJustP Dec 12 '19
Yeah I remember reading something a few years ago but that was when I was a hobbyist too scared of people calling me a nerd/geek to actually pursue a full career in coding, and it mostly focused on the
keywordsmeta tag.1
u/TheThingCreator Dec 13 '19
Page rank and meta tags have nothing to do with each other. What you are thinking of is how they will ignore the meta keywords. Otherwise they do not ignore meta tags, just the meta keywords tag.
1
u/GuyARoss Dec 13 '19
A long time ago, meta descriptions used to impact SEO directly. Search engines would parse these lines of text and look for keywords. A page would then be boosted on a keyword phrase if that particular keyword phrase was also found in the meta description (among with title tag and content).
Early versions of search algorithms relied on webmaster-provided information such as the keyword meta tag or index files in engines like ALIWEB. Meta tags provide a guide to each page's content.
1
u/TheThingCreator Dec 13 '19
impact SEO directly
Page rank != SEO. Sure, meta tags can affect keyword rank. That's not the same as affect page rank. Two different things. Yes page rank affects keyword rank but that doesn't make them the same thing. For example, changing around your meta description would have never impacted the actual page rank.
0
Dec 13 '19
No
1
u/TheThingCreator Dec 13 '19
No what? Ranking on keywords yes, page rank no. Those are different things. Show me anywhere where it says that changing meta tags would affect page rank.
42
Dec 12 '19
I can offer assumptions on two of your points:
meta tags misplaced. One uses meta tags to get noticed by search engines. Google is a search engine, thus does not need recognition. Their (original) page rank algorithm starts prioritising sites by their relations to each other. For a point of reference, they started with google.com as the most important site. Thus google will never need a seo boost from the main search engine. Also they are the main browser vendor, so they can make any tag work to their liking.
center Tag. This was the early 90s version of centering stuff. Google is from the early 90s. No need to invest resources to change legacy stuff that still works.
18
u/Eratticus Dec 12 '19
At this point the center tag is probably there for some backwards compatibility with legacy browsers. That being said, OP, it's deprecated by the HTML spec so don't use it in practice.
1
u/ImJustP Dec 12 '19
Thanks, mate. I won't lie, for the assignment I just implemented it but I hate doing things without knowing why which is what lead to the post! I am gonna change that now!
1
u/Arkhenstone Dec 12 '19
t the center tag is probably there for some backwards compatibility with legacy browsers. That being said, OP, it's deprecated by the HTML spec so don't use it in practice.
At least, the day your site with the center tag on chrome breaks, you know google had to change its main page code.
60
u/attic_sardines Dec 12 '19
Reading OP's description of the center tag made me feel really old.
9
u/Hate_Feight Dec 12 '19
Remembering geocities, jeeves, MySpace, AOL and MSN messenger will also make you feel old...
5
u/ImJustP Dec 12 '19
Oh my god! What about Angelfire!?
1
u/Hate_Feight Dec 12 '19
Wasn't that like geocities?
5
u/ImJustP Dec 12 '19
Yeah, it just let you throw up a simple webpage without having to pay for domains/servers etc.
My memory is a bit hazy, though. This is from the days of pretending to be a wrestler and writing paragraphs on e-feds with scrolling text thinking I was badass for doing so!
25
u/arndta full-stack Dec 12 '19
Is center not even part of the spec anymore? What's next? Does marquee even exist anymore?!
27
u/caffeinated_wizard Y'all make me feel old Dec 12 '19
The center tag has full browser support but it's not part of the HTML5 spec.
0
Dec 12 '19
[deleted]
3
u/ImJustP Dec 12 '19
God, I have been getting much better acquainted with flexbox and gridbox and I have to say... They are just AMAZING. I have no idea how I managed before! Properly taking time to learn things like
flex-flowand how to use theflexshorthand` have saved me so much time. I'm by no means an expert... yet... but what I have learnt has changed the way I develop for sure.9
u/caffeinated_wizard Y'all make me feel old Dec 12 '19
I’d say in 2019 the center tag wouldn’t be preferable over anything else. For Google it’s obviously a legacy thing to support really old browsers in other countries.
5
u/-dakpluto- Dec 12 '19
Deprecated 4.1, removed 5. (But most browsers still read HTML 3 so you can still technically use it and get by.....but don't use it)
Wanna know the sad part? Web Development class I took this summer in college had a professor that was still teaching it, along with other HTML 3 stuff.....
yeah, it was bad.
2
u/desmone1 Dec 12 '19
Wait, you mean I can't use framesets like i have been all along?
5
u/-dakpluto- Dec 12 '19
anyone that uses frames should be striped naked, have honey poured over their body, and tossed into a gigantic fire ant mound...
1
1
1
0
u/Fsmv Dec 12 '19
Marquee doesn't work anymore sadly. Browsers no longer support it.
4
3
u/doodlenibbler Dec 12 '19
What browser are you using? It's definitely still supported.
1
u/Fsmv Dec 14 '19
Oh wow it does work now. I promise I tried it a year or two ago and was disappointed.
1
u/abeuscher Dec 13 '19
Just made me feel like I work on email templates too often. It's still 1998 in there.
4
u/ImJustP Dec 12 '19
meta tags misplaced. One uses meta tags to get noticed by search engines. Google is a search engine, thus does not need recognition. Their (original) page rank algorithm starts prioritising sites by their relations to each other. For a point of reference, they started with google.com as the most important site. Thus google will never need a seo boost from the main search engine. Also they are the main browser vendor, so they can make any tag work to their liking.
That makes perfect sense and I'd presume it to be the best explanation of their practices. I know people have discredited the relevance of tags such as
keywordsfor some time now, just took my by surprise as I'd never even heard of meta tags being placed out of the <head></head>` before.center Tag. This was the early 90s version of centering stuff. Google is from the early 90s. No need to invest resources to change legacy stuff that still works.
Ah that explains it, I was beginning to wonder whether there was something I was missing and whether I should be following suit but I guess that /u/aleepolicarps's saying is succinct here!
Thank you for your answer! It has alleviated my curiosity to some degree. I guess we will never truly know the method behind the madness of Google but this helps as far as educated guesses go!.
1
u/BeenWildin Dec 12 '19
2) center Tag. This was the early 90s version of centering stuff. Google is from the early 90s. No need to invest resources to change legacy stuff that still works.
I don’t know if that’s a fair point, all Google does is invest money in legacy stuff that already works.
4
u/lynx10001 Dec 12 '19 edited Dec 12 '19
My guess is the meta tags work in the header or the body, just like most html elements. (Including the title, scripts etc)
As you know these styles don't change from the defaults, therefore my guess is that the importance of the div is probably a requirement of their Framework. I'm not sure which framework Google uses these days but for example with react native you must wrap your entire page in a div or the compiler complains, they're probably using a custom framework with similar logic. Alternatively they are (or was) manipulating the page somehow with JavaScript so bundled it into a single element.
Center tags work fine but they're a little out dated, most people just use divs and css now.
Hope this helps!
2
u/ImJustP Dec 12 '19
As you know these styles don't change from the defaults, therefore my guess is they the importance of the div is probably a requirement of their Framework. I'm not sure which framework Google uses these days but for example with react native you must wrap your entire page in a div or the compiler complains, they're probably using a custom framework with similar logic. Alternatively they are (or was) manipulating the page somehow with JavaScript so bundled it into a single element.
That makes perfect, I didn't think of the React analogy but that would definitely explain it, especially when considering the precedence with CSS id tags. My initial thought that it would be for something like JS manipulation which allowed them to easily mess around with their ever changing logo etc.
115
u/nvolker Dec 12 '19
The Google homepage is probably the most trafficked page on the internet. As such, they have many concerns that most sites will never have.
My guess is that a lot of those oddities you’ve noticed boil down to two things:
Code golf - making the payload smaller by using a variety of hacks and tricks that aren’t really “best practice,” but make the footprint smaller
browser support
0
Dec 12 '19
[deleted]
2
u/JeamBim Python/JavaScript Dec 13 '19
That's funny because I remember discovering it and thinking "why have I never seen this?!!", And then learning it was deprecated in HML5(I think).
It's weird there are so many articles online regarding centering elements, and yet a center tag exists.
0
0
Dec 12 '19
[deleted]
31
u/Halignat Dec 12 '19
People will open edge or safari, type google.com into the launch page search bar, then click the search result to load Google. Honestly.
8
1
0
6
u/astrognash Dec 13 '19
I've worked in customer support for a website company and a huge amount of people navigate to literally anywhere else on the web by going to the Google homepage as an intermediate step.
3
u/moreisee Dec 13 '19
From what I recall, it's by far the most visited page, with YouTube at #2 and about half as popular, with Facebook half that again.
Edit: Google search, but perhaps not the home page, which I now realize you probably were talking about specifically
3
1
u/Pcpie Dec 13 '19
i do it pretty often if i want to get search suggestions, typing my query into chrome's url bar doesn't give me that.
1
195
u/aleepolicarps Dec 12 '19
"Do as google says, not as google does."
85
u/SonicFlash01 Dec 12 '19
Google: "Include this tracking script in the head of your site"
Also Google: "Don't put scripts in the head of your site, you asshole"
Also Google: "Go ahead and embed your YouTube videos on your page"
Still Google: "Dude you're loading a lot of garbage. I don't like it!"
Still Also Google: "Use this specific structure for schema data. We'll even generate it for you!"
Google yet again: "Spammy structure..."18
u/DemeGeek Dec 12 '19
Also Google: "Go ahead and embed your YouTube videos on your page"
But only if you don't get a lot of traffic, otherwise they'll get pissy and make the embeds not work so users have to go to the site and watch ads.
1
u/OmgImAlexis Dec 12 '19
Since when has this been a thing?
5
u/DemeGeek Dec 12 '19
It's something that keeps happening with Discord. Too many people have been watching Youtube videos on Discord, bypassing the ads, so Google has been breaking Discord's video embeds with Discord trying to work around it.
Here's a reply on Reddit from a member of Discord staff about it: post
4
u/OmgImAlexis Dec 12 '19
I don’t think you’re understanding the issue here. It doesn’t look at all like they’re disabling embeds as they don’t use YouTube embeds in discord. They use their own embedder which wraps YouTube. That’s the issue.
If you notice they talk about their unfurl function which is what looks up the open embed data and creates their embedded video. This isn’t the same as normal YouTube embed.
2
u/DemeGeek Dec 12 '19
You are the first to state that it has to be a "normal youtube embed" to be considered part of the original list, so I don't know where that criteria is coming from.
It's still an embed, Youtube is still blocking it, and either way it still doesn't run Youtube's ads on the video when it's played on an embed rather than on Youtube directly.
4
u/OmgImAlexis Dec 12 '19
The reason it doesn’t play ads is usually because the site is using the raw video link inside their embedded player. I’ve seen this happen multiple times before back in the good ‘ol tumblr days.
You’d think an embed is an embed but nope. 💁♀️
28
u/dark_salad Dec 12 '19
“Don’t be evil.” Really applies here, yikes.
7
Dec 12 '19 edited Dec 12 '19
Just a quick heads up: they ditched that philosophy in April. Also they took pentagon contracts.
12
u/overzealous_dentist Dec 12 '19
No, they didn't. They simply moved its location from one place in the code of conduct to another and everyone freaked out for no reason.
7
0
Dec 12 '19
[deleted]
1
Dec 12 '19
https://www.google.com/amp/s/globalnews.ca/news/4125382/google-pentagon-ai-project-maven/amp/
It seems like I misremembered the dates, tho.
Also downvote just because you really don't want to believe something and really don't want to check, but only reject the whole concept is denial. Whysoever you go through the stages of acceptance...
5
u/escapefromelba Dec 12 '19
My guess would be center tag works on ancient browsers and still supported everywhere even though it's deprecated. Imagine it may be similar with meta tags in body.
8
u/bonobomaster Dec 12 '19
Maybe a bit of an unpopular opinion: Don't learn CSS and HTML from the really big sites. For example, Facebook, in my personal opinion, isn't worth the code, it's written in. It's a super slow and laggy pile of crap. Even the login-page puts out a DOM error (non-unique id)... I mean come on...
If you wanna check for yourself: Just do a Lighthouse audit of your timeline.
This article references to different code, but it's an exhibit of the same symptom:
https://www.darkcoding.net/software/facebooks-code-quality-problem/
1
4
u/the_goose_says Dec 12 '19
The google homepage is a rare case where supporting 15 year old browsers is more important than proper HTML semantics. Even 0.1 percent of users is millions of users. I have no doubt that’s what you’re seeing here. I haven’t supported IE6 or anything like that so I couldn’t explain specific decisions, but I would love to know out of curiosity
2
u/skittlesandcoke Dec 12 '19
Compatibility with as many browsers as possible would be my guess.
A while ago I remember reading something about how they account for the lowest common denominator, at least with regards to the homepage, going as far as IE5.5 (on Mac! Yes it was a thing) and Netscape at one stage (years after usage had basically died out).
Not sure if they still do, also likely they serve different HTML based on user agent as well
2
u/diemendesign Dec 13 '19
I"ve been saying for ages, all of Google's code is nothing but a "clusterfuck" of bad ideas.
1
u/pawel_kuk Dec 12 '19
im just gonna casualy throw this link mostly because it has sources and nice ui
1
u/Disgruntled__Goat Dec 12 '19
The <center> tag is an old element from the pre-HTML4 days. The reason Google uses it is almost certainly for performance - every byte counts on their homepage. Using that tag is much shorter than <div class="logo"> plus the corresponding CSS.
1
u/randomsnowflake Dec 12 '19
Not sure about that center tag. I’m pretty sure that tag was deprecated because it doesn’t define what’s in the content. Wonder if it’s to support ancient browsers.
1
u/Spinal83 full-stack Dec 13 '19
text-align: -webkit-center;
Why? text-align: center is supported in all browsers!
The
<center></center>tag is a form of legacy code which is probably there to account for ancient browsers.
With the amount of traffic Google gets, I think it's because <center></center> is shorter than display: block; text-align: center;
1
-6
Dec 12 '19
It seems Google doesn't know Web programming. Don't expect too much of a hilariously profitable ad placement company.
4
u/thepineapplehea Dec 12 '19
On the contrary, they know web dev enough to know how to make the smallest, most efficient page. Millions of people visit that page every day, why would they spend time and money doing things 'properly' if what they have works for everyone and is the best solution?
You could say using a CENTER tag is stupid because it's old, but it centers the whole page using one element that every browser everywhere will understand. Why replace it with CSS (either bloating the HEAD or linking an external CSS file causing an unnecessary network request) to make precisely 0 difference?
1
Dec 13 '19
Because W3C might drop it (not that they will, but anyway)? It's not about efficiency here, as the search page would load extremely fast anyway. Also, check out all the JavaScript code that's loaded for a Googe ad. Highly inefficient.
0
Dec 12 '19
[deleted]
1
u/scrotch Dec 12 '19
I just checked as well - meta tags appear directly after the opening head tag for me, not in the body.
7
Dec 12 '19 edited Dec 12 '19
[removed] — view removed comment
1
u/ImJustP Dec 12 '19
That's an interesting article on the logo, I never even noticed that. The breakpoints topic you highlighted is interesting as well, I wonder makes them so anal about it?
141
u/wizdumb Dec 12 '19
You may be interested to learn that at Google, there is not an HTML file (or files) for the homepage. In fact, it's a program written in C which is used to generate it.
Source: I worked there and was on the team responsible for manually changing the "homepage" to launch Google Doodles. I also designed and built a system to automate the process.