Add original link to octopress article

Source: Internet
Author: User

The role of adding the original link to the blog post is not much to say. Because in the Internet to find articles or years of change, or have important errors, so I summarize the record to make a memo.

    • Add POST_FOOTER_FILTER.RB Plugin
    • Customizing the Display information
    • Differentiate link information from article content
    • Related articles
Add POST_FOOTER_FILTER.RB Plugin

There are multiple posts on the web that have the same content, but when you add plugins to them, there are errors like Post_filters plug-ins that do not exist when you execute rake generate.

Checked, the plugin is not post_filters.rb in version 2.0 of octopress, so the plugin needs to be modified. Finally, a newer plugin was found on GitHub, the suspect plugin's first referrer, as follows:

1 2 3 4 5 6 7 8 9 Ten  One  A  -  -  the  -  -  -  +  -  +  A  at
## post_footer_filter.rb# Append every post some footer infomation like original URL# Kevin Lynx# 09.01.2014# require ' octopress-hooks '  module appendfooterfilter  def self. Append (post)  author = post. site . Config [' author ']  url = post. site . Config [' url ']  pre = post. site . Config [' Original_url_pre ']  Post. content + %q[<p class= ' post-footer ' >  #{pre or "original link:"}   <a href= '#{post. Full_url }' >#{post. Full_url }</a><br/>  written by <a href= '#{url}' >#{author  }</a>  &nbsp;posted at <a href= '#{url}' >#{  URL}</a> </p>]End class postfilters < octopress::Hooks: : Post  def pre_render(post)  Post. content = Appendfooterfilter :: Append (post) End

Copy without indentation, want to see the original can be here: https://github.com/kevinlynx/codemacro-source/blob/master/plugins/post_footer_filter.rb

Then at the end of the article there is the original link information

Customizing the Display information

As can be seen from the plugin content, the default display before the link "original link:" Can be specified by the Original_url_pre parameter. Only need to add in _config.yml

original_url_pre: "显示信息"

As you can see from the plugin content, the other items are taken from _config.yml existing variables, so you can change the display information by defining the variables yourself or modifying the plugin content directly.

Note: in the article adding a piece of information to each article for octopress, the Original_url_pre is mistakenly written as a origional_url_pre, causing it to not display correctly.

Differentiate link information from article content

By default, the Added link information cannot be distinguished from the content of the article on display. You can add a row to the SASS/CUSTOM/_STYLES.SCSS:

 .post-footer   { margin-top  :  10    padding  :  5  px   background  :none  repeat  scroll  0pt  0pt   #eee   font-size  :90  %   color  :gray      
TD class= "Code" >
1  

Note that there is more than one place on the Web to write the file name _style.scss. There is no language.

Related articles

Add an article message to each article for octopress, and other articles refer to it.

Two articles that made the same mistake:

http://biaobiaoqi.github.io/blog/2013/07/10/decorate-octopress/

http://812lcl.com/blog/2013/10/26/octopressce-bian-lan-ji-ping-lun-xi-tong-ding-zhi/

Original link Address: http://pangyi.github.io/blog/20150125/wei-octopresswen-zhang-jia-ru-yuan-wen-lian-jie/
Written by pangyi?posted at Http://pangyi.github.io

Add original link to octopress article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.