作者GALINE (天真可愛CQD)
看板PHP
標題Re: [請益] 如何對Content-Disposition標頭加下載標題?
時間Mon May 23 14:14:17 2016
※ 引述《red0whale (red whale)》之銘言:
: 假設我有一個PDF檔叫test.pdf,該檔存在http://www.example.com/download/裡面
: 今天如果有人點進了這個PHP頁面裡頭,就會自動下載這個PDF檔案
: 我的這個頁面被Google的「爬蟲」找到了,並被放在他們的搜尋引擎資料庫裡
: 但是問題在:他們顯示出來的結果標題居然顯示「Untitled」,而且沒有說明內容
: 明明我原先的PDF檔(test.pdf)有標題啊,
: 為什麼他們搜尋出來的結果卻是沒有標題和說明內容呢?
: 請各位幫我解惑一下…
: 謝謝
今天很忙,直接貼我用了什麼關鍵字跟找到的結果
因為看不到你實際的檔案,所以也不知道你是不是踩到這問題
「google search result pdf title」
https://www.google.com.tw/search?q=google+search+result+pdf+title
第一筆
https://webmasters.googleblog.com/2011/09/pdfs-in-google-search-results.html
Q: How can I influence the title shown in search results for my PDF document?
A: We use two main elements to determine the title shown: the title metadata
within the file, and the anchor text of links pointing to the PDF file.
To give our algorithms a strong signal about the proper title to use,
we recommend updating both.
關鍵句:
title metadata within the file
anchor text of links pointing to the PDF
PDF 檔案有個標題設定(所以不是你第一行打很大的字他就知道那是標題)
連過去的連結文字
「pdf title metadata」
https://www.google.com.tw/search?q=pdf+title+metadata
第一筆
https://helpx.adobe.com/acrobat/using/pdf-properties-metadata.html
Choose File > Properties.
Click a tab in the Document Properties dialog box.
--
莉娜用魔法爆破進入屋內。
劫犯從另一個房間裡出現,大叫道︰「妳是誰!」
莉娜︰「我是個可疑的女人!」
劫犯無言以對。
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.248.122.206
※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1463984064.A.6AF.html
→ AndCycle: 我實際 google 了幾個pdf,實務上 google 現在好像是直接 05/24 02:25
→ AndCycle: 讀 pdf 內文的第一句話當標題, 其他資訊都不拿來用了 05/24 02:25
→ GALINE: 我不太常處理PDF,不過經驗是Google會同時看好幾種資料 05/24 04:50
→ GALINE: 就算是網頁,也可能有時抓title有時抓內文有時自己組字串 05/24 04:51
→ GALINE: 而「Untitled」這個字串不太可能是Google自組的,感覺滿 05/24 04:52
→ GALINE: 可能是從PDF的meta來,除非原文內文就有大大的Untitled... 05/24 04:53
→ AndCycle: 原po的pdf打開是一張圖, 原文就算有也是蓋在圖下面了 05/24 16:34
昨天眼花沒看到實際檔案....
從 Meta 看起來是有設定 Title,但是 PDF 裡面真的是有圖無字
看來真的是 Google 找不到他喜歡的文字所以把標題遮掉了.......
這樣的話,在圖片後面蓋一段字可能能夠讓Google願意改標題,可能...
※ 編輯: GALINE (60.248.122.206), 05/24/2016 22:11:42
→ AndCycle: 你可以隨便 google 幾個 google 有標題的 pdf 05/25 00:15
→ AndCycle: 你會發現一堆都 meta 亂設的, google 根本不愛讀 meta 05/25 00:15