VCF

Unit 1 · How the web works

Why #/ hash routes are not separate pages

Everything after # stays in the browser, so cornerbakery.ca/#/menu asks the server for /, the home page. To a server and a search engine there is one page, not two.

The mix-up

What people often think

“cornerbakery.ca/#/menu is the same as cornerbakery.ca/menu.”

What the tutor says

Everything after # stays in the browser, so the server only sees the home page, /. Some apps fake pages this way, but search engines and servers see one page.

What path does the server see for cornerbakery.ca/#/menu?

How it works

Some apps fake extra pages with the fragment: /#/menu, /#/order. JavaScript reads the fragment and swaps the content. It works for someone clicking around, but every one of those addresses sends the same request for the home page.

Waiting will not fix it. A search engine cannot find a separate order page because, as far as the request is concerned, there is none. Give each page its own path, such as /order, so the server and search engines can see it.

Side by side

The mix-upExample
cornerbakery.ca/#/order   →  server sees  /
One page as far as anyone outside the browser can tell.
What worksExample
cornerbakery.ca/order     →  server sees  /order
A real path: shareable, indexable, its own page.

Close cousins of this mix-up

The tutor watches for these in the same lesson.

  • “Search engines will find every page eventually.”

    Waiting will not help, because to the search engine there is no separate order page to find. It needs a separate path, like /order.

Practise it with a tutor watching

Parts of a URL

Name each part of a URL and say which parts reach the server.

15 minutes See it Build it Break it Say it
Start the lesson

Free, no account needed.