內容簡介
WordPress 中可以以多種方式對文章進行分組,但卻沒有直接的版本控制系統。這個外掛為想要為一組文章進行版本控制的使用者提供了一個輕量級的解決方案。
使用這個外掛需要定義每個版本控制組的關鍵字。然後在這個組中的每個文章標題的前綴中使用這個關鍵字。外掛將自動排序最新的文章,並將其餘文章標記為過期。
此外,它還可以讓您擁有一個 URL,始終指向該版本控制組的最新文章。這樣,您可以將該 URL 分享給他人,並確保您的訪客始終查看最新的文章。
這個外掛會自動執行以下操作:
確定文章是否屬於一個版本控制組。
根據發佈日期搜索並找到最新的文章。
將該組中較舊的文章標記為過期。
對於經常重新訪問舊主題並需要手動更新文章鏈接的博客作者來說,這尤其實用。或者,如果您像我一樣透過博客平台發布應用了版本控制的內容(例如軟體),那麼使用這個外掛也很方便。
使用方法
使用這個外掛的第一步是訪問外掛的選項頁面(“設置”-〉“文章版本控制”)。
在那裡,您將找到兩個字段:
關鍵字列表字段,您需要用逗號和空格“,”隔開,輸入您想要跟踪的所有關鍵字。每個關鍵字都定義了一個不同的版本控制組。
最新文章 URL 的路徑。默認情況下,路徑是“/current”。因此,如果我們有一個名為“ajax”的關鍵字,那麼 URL:http://www.myblogaddress.com/current/ajax 將指向“ajax”組的最新文章。
要將文章連接到一個版本控制文章組,您只需在這篇文章的 post_name 的前綴中輸入該組的關鍵字。因此,在之前提到過的“ajax”組中,該組中的所有文章都應以“ajax-”作為前綴。該組文章的例子可能為:
ajax-first-post
ajax-updated-version
ajax-latest-news
等等。
該外掛將自動查找並標記同一組的較舊文章,並插入“”標記。在運行時,它會被“outdated.html”的內容替換。這是關於如何設計過期 tag 的示例。只需將其與您的其他樣式一起插入:
<style>
p.outdated{
border: dashed 1px #f00;
background: #eee;
color: #f00;
text-align: center;
}
p.outdated a {
color: #f00;
}
</style>
卸載也應該很容易。唯一留下來的是在舊的文章內容中的“”注釋,當查看網頁時,它們當然會被忽略。如果您不介意,那麼您無需做任何其他事情,只需通過 WordPress 管理頁面停用插件即可。
許可證
這項工作是根據 GNU 通用公共許可證的條款發佈的:
http://www.gnu.org/licenses/gpl-2.0.txt
外掛標籤
開發者團隊
原文外掛簡介
Posts can be grouped in many ways in WordPress but there is no direct version control system. This plugin offers a lightweight solution if you want version control for a group of posts.
To make this work you define a keyword for each version control group you want to create. Then use that keyword as a prefix in the post name of each post in that group. The plugin will sort out the latest post automatically and label the rest as outdated.
It also let’s you have a URL that will always point to the latest post of that version control group. That way you can give out the URL to others and be sure that your visitors will always be viewing the most recent post.
This plugin will automatically:
Define if a post is part of a version control group.
Search and locate the latest post by publish date.
Label the older posts of the group as outdated.
This is especially practical for bloggers that often revisit older subjects and have to do the linking with the updated posts manually. Or if you are like me and publish material that has versioning applied to it (ex. software) through a blogging platform.
Usage
First thing you should do is visit the plugin’s options page (“Settings” -> “Post Version Control”).
There you will find two fields:
The keyword list field, where you enter all the keywords you want to track seperated from each other by a comma and a space “, “. Each of them defines a different version control group.
The path for the latest posts URL. By default the path is “/current”. So if we have a keyword named “ajax” the URL: http://www.myblogaddress.com/current/ajax will point to the latest post of the “ajax” group.
To link a post to a version control group of posts all you need to do is enter the keyword of that group as a prefix to the post_name of that post. So in the group “ajax” mentioned earlier all posts in that group should start with the “ajax-” prefix. An example list of that group of posts might be:
ajax-first-post
ajax-updated-version
ajax-latest-news
..and so on.
The plugin will automatically look through your posts of the same group and label the older ones by inserting an tag. This is replaced by the content of “outdated.html” in runtime. This is an example of how you can style your outdated tag. Just insert it along with your other styles:
Uninstalling should be pretty easy too. The only left overs are the comments in the old posts content which of course are ignored when viewing the webpage. If you don’t mind that you don’t have to do anything else apart from de-activating the plugin through your WordPress administration.
License
This work is released under the terms of the GNU General Public License:
http://www.gnu.org/licenses/gpl-2.0.txt
