React | Next.js 總覽

James Pan
Dec 29, 2020

使用 Next.js 的目的不外乎就是為了 Server Side Render(以下簡稱SSR)。SSR 有助於 SEO 的優化及排名,曝光更多你想透漏的資訊。一般我們現在使用的前端框架多屬於 Client Side Render(CSR) 的領域。當然,我們可以單純依賴前端框架製作出 SSR 的效果,但那只會大幅增加專案複雜度,且不是本章範疇就不再贅述。

CSR 為何不利於 SEO ?

我們可以透過『檢視網頁原始碼』看到 <div id="root"></div>裡什麼都沒有,如下圖:

當爬蟲針對該頁面爬取資料時,無法取得有用資訊

沒錯,這就是最一開始我們暴露在瀏覽器的資訊,網頁被呼叫出來才會在 Client 端渲染畫面,所以爬蟲自然爬不到任何有用資訊。

回到本文主角 Next.js,由於單元眾多,因此後續上傳單元也會一併更新在此當作目錄

React | Next.js 路由管理

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response