Yesterday, when I just google my own site. I find the results show like this:
But I did not want every page without description shows the site’s description.
Cause it is not good to index pages by search engine.
So I want to optimizate the octopress plugin or called code to add the description and keywords.
Old Code
This is the old code.
1 2 3 4 |
|
And the article that include the old codes about the octopress seo.
The results I dislike codes bring about are show the page’s description as same as the site’s description.
So I change codes to show part of the page’s content as description instead of site’s description.
Add Description and Keywords new version
1 2 3 4 5 |
|
The code is not a ruby file, please add the codes or change the original code to these after the author meta in source/_include/head.html
.
Then the meta will show like :
When you change the codes to these. 1. If the page has a description, it will show the description 2. If has not and this page is a page, it will show the part of page content. 3. Otherwise, show the site’s description, like the homepage.
PS: page means page/post/other links, not just rake new_page's page
And the keywords’ code is like the description’.
Version 3
Optimization about the page with number’s title and description.
The Original Link: http://baham.github.io/05_07_octopress-add-description-keywords-plugin-optimization.html
If you want to reprint it, please do under the CC BY-NC-SA 4.0