Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SPA SEO
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
blue chen
February 27, 2014
Technology
860
12
Share
SPA SEO
at Happy designer meetup 2014.02.27
blue chen
February 27, 2014
More Decks by blue chen
See All by blue chen
RelaJet Caption
iamblue
0
140
The future of hearing device - 聽覺領域新的機會及挑戰
iamblue
2
290
20180918-Digitime 導入MCU設計 催熟智慧語音辨識應用市場
iamblue
0
260
Pixnet hackthon - workshop
iamblue
0
150
AI 人工智慧學校分享
iamblue
0
440
Javascript -Full stack 物聯網開發
iamblue
0
170
MCS Lite 私有雲物聯網開發
iamblue
0
340
Blockchain for IoT 應用
iamblue
1
270
2017.01.16 Embedded system
iamblue
0
150
Other Decks in Technology
See All in Technology
さきさん文庫の書籍ができるまで
sakiengineer
0
360
コードレビューを制するチームがソフトウェアデリバリーのフローを制す / Beyond Code Review: Distributing Its Responsibilities Across the SDLC
mtx2s
3
1k
Databricks における 生成AIガバナンスの実践
taka_aki
1
310
AIにフローを作らせようとして挫折した話
hamatsutaichi
0
170
Agentic Web
dynamis
0
100
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.8k
イベントストーミングとKiroの仕様駆動開発で実現する要件の認識合わせプロセス
syobochim
7
1.2k
AI と創る新たな世界 / A New World Created with AI
ks91
PRO
0
110
「コーディング」しない人のための Claude Code 入門 ChatGPT の次の一歩 — 業務に組み込む 育成・共有・自動化
rfdnxbro
2
1.2k
「嘘をつくテスト」の失敗例から学ぶ 良いテストコード #frontend_phpcon_do
asumikam
0
230
Dario Amodi『Policy on the AI Exponential』を理解する
nagatsu
0
160
Claude Codeを組織で使いこなす— サーバサイドAIエージェント運用の実践知
techtekt
PRO
0
200
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
380
Why Our Code Smells
bkeepers
PRO
340
58k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
310
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
770
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Six Lessons from altMBA
skipperchong
29
4.3k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
250
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Transcript
I am Blue Web engineer @ YouMeb
⽤用nginx 1. SEO基礎 本⽇日⼤大綱 2. How to make SPA app
SEO friendly 3. 如何⾃自動化部屬SEO內容? 4. 溫馨⼩小提醒
SEO 基礎
Web Crawler
講到蜘蛛...我就想到.... 三級的天擎坦克被它摧毀了T.T 蜘蛛好像很厲害?
! SEO crawler 並⾮非很聰明
<html> <head> <title>這是title</title> </head> <body> <h1>Hello World!</h1> </body> </html> <html>
<head> <title>{{ title }}</title> </head> <body> <script> //do some ajax awesome thing.. </script> </body> </html> 靜態網⾴頁(無ajax) 靜態網⾴頁(有ajax)
So…要如何告訴這些 Crawler 你的網站是⽀支持AJAX呢?
www.example.com/ajax.html#mystate 網址有兩種 ! www.example.com/mystate 無hash: 有hash: 如何告訴這些 Crawler 你的網站是⽀支持AJAX呢? www.example.com/#/mystate
www.example.com/ajax.html#mystate 從網址下⼿手(有hash) 1. www.example.com/ajax.html#!mystate
www.example.com/ajax.html#!mystate 當 Crawler 收到要爬這段網址內容時 www.example.com/ajax.html?_escaped_fragment_=mystate 會對你的server發⼊入下列request (以google crawler 為例)
www.example.com/ajax.html?_escaped_fragment_=mystate 你的server接受到這樣的訊息時 回傳 crawler 對應的 SEO Data page/內容 (以google crawler
為例)
從網址下⼿手(無hash) 2. <meta name=”fragment” content=”!”> 請在<head>加⼊入: www.example.com?_escaped_fragment_=mystate (以google crawler 為例)
AngularJS解法 3. 有hash: 無hash: <meta name=”fragment” content=”!”>
! ⽩白話理解 crawler 對server請求流程
None
google/facebook crawler your app server www.example.com/mypage#!home 會發出⼀一段特殊的請求網址 回傳 SEO data
rendering page
Make SPA app SEO friendly
多數的語⾔言 framework 框架 SPA SEO 解決⽅方案
<html> <head> <title><%= title %></title> </head> <body> <h1>Hello World!</h1> </body>
</html> 當餵給crawler前,SEO Data 被先在server端印好輸出 Nodejs EJS <html> <head> <title>hello</title> </head> <body> <h1>Hello World!</h1> </body> </html> Nodejs 印出這些變數 crawler res.render({title:’hello’});
每個使⽤用者進來都會先經過SEO data Output 缺點 浪費資源
加上...如果前端的⾴頁⾯面只是靜態檔案怎辦? (像是yeoman產⽣生的app)
還是要有⼀一個東⻄西去處理餵給crawler SEO data 2. 架⼀一個nodejs server 處理(網址複雜) 1. 直接nginx指向(網址簡單) 3.
nodejs+nginx
直接nginx處理 但網址複雜很⿇麻煩
⼀一台 nodejs server 直接來
nginx + nodejs nginx 過濾來⾃自crawler 還是 user ? nodeJS 處理rending
page
nginx 靜態⾴頁⾯面路徑 SEO server ⼀一般使⽤用者 crawler nodejs server 處理 SEO
data render
Nginx設定 你的處理SEO data render Nodejs server位置 因為各家的crawler發出請求格式不⼀一 最好⽅方式是⽤用user agent在經過nginx時過濾
live demo
如何⾃自動化部屬SEO內容
⽤用nginx facebook . google friendly SEO data內容 image, title,url, description,og系列
! 那網站內容呢?
html-snapshots 1. use phantomJS 2. ⽀支援輸出 sitemap.xml, robots.txt,
arbitrary input 3. 有grunt版本
$ npm install grunt-html-snapshot
None
網站圖⽚片截圖:https://github.com/clkao/prerender-opengraph-image
live demo
溫馨⼩小提醒
⽤用nginx 知此知彼 https://support.google.com/webmasters/answer/164734?hl=zh-Hant 了解 SEO也要了解 search engine policy
End.