WordPress 使用 Yoast SEO Plugin 主要只是想讓他幫我加些 Meta Tag, ex:
- <link rel="canonical" href="https://blog.longwin.com.tw/">
- <meta property='og:locale' content='zh_TW'>
- <meta property='og:type' content='website'>
- ...
不知道哪個版本的更新後, 現在居然出現網站名稱重複出現的問題, 如下述:
- WordPress › Support » Site Title Showing Double
- WordPress › Support » WordPress SEO Yoast - Double title in Google search
WordPress 使用 Yoast SEO Plugin 造成 標題 重複出現問題修復
Yoast SEO Plugin 造成 標題 重複出現的問題, 解法居然是要修改 Theme(Template) 的 header.php, 當下就想把這個 Plugin 移掉了.
但是, 再看原始碼的過程, 沒想到這套 Plugin 還做蠻多事情的, ex: (連 Twitter 的都加入了. XD)
- <meta name="twitter:card" content="summary"/>
- <meta name="twitter:site" content="@tsung"/>
- ...
於是, 為他開個特例, 來修改 Theme 吧.
WordPress 使用 Yoast Plugin 造成標題重複出現的修復步驟如下:
- cd /blog_path/wp-content/themes/twentyten # 我是用 twentyten, 其他的我不曉得會不會有衝突.
- vim header.php 將下述程式碼改掉
- <title><?php
- /*
- * Print the <title> tag based on what is being viewed.
- */
- global $page, $paged;
- wp_title( '|', true, 'right' );
- // Add the blog name.
- bloginfo( 'name' );
- // Add the blog description for the home/front
- // page.
- $site_description = get_bloginfo('description', 'display' );
- if ( $site_description && ( is_home() || is_front_page() ) )
- echo " | $site_description";
- // Add a page number if necessary:
- if ( $paged >= 2 || $page >= 2 )
- ?></title>
- 改成這樣子
- <title><?php wp_title(''); ?></title>
- 存檔即可.
Yoast SEO Plugin 會將所有頁面的 Title 重新配置, 不過看起來主要差異就是把 "|" 換成 "-", 剩下的應該都一樣, 在自行評估看看囉~ 🙂
哈囉 搜尋yoast問題找到您的文章
請問一下~目前我的網站也有用yoast
內頁都可以後台手動修改google search的Title和description
但index首頁的卻沒辦法後台手動修改
不曉得您是否有什麼建議方向呢?
謝謝
index 不用改啊!不會有重複的問題