2
头图

The first part "How much do you know about the blog system: revealing the unknown knowledge (2)" introduces the basic function design points of the blog, and this article introduces the protocol or standard of the blog.
Due to the length of the article, this article will be divided into 4 articles, the directory is as follows:

  1. The past and present of "blog"
  2. My blog story
  3. Who is the audience of the blog?
  4. Essentials of the design of the basic functions of the blog
    4.1 Article (Post)
    4.2 Comment
    4.3 Category
    4.4 Tag
    4.5 Archive
    4.6 Page
    4.7 Subscription
    4.8 Version control
    4.9 Theme and personalization
    4.10 Users and permissions
    4.11 Plugin
    4.12 Processing of pictures and attachments
    4.13 Sensitive filtering and review review
    4.14 Static
    4.15 Notification system
  5. Blog protocol or standard
    5.1 RSS
    5.2 ATOM
    5.3 OPML
    5.4 APML
    5.5 FOAF
    5.6 BlogML
    5.7 Open Search
    5.8 Pingback
    5.9 Trackback
    5.10 MetaWeblog
    5.11 RSD
    5.12 Reader view
  6. What are the knowledge points of designing a blog system
    6.1 Really use UTC for all time zones?
    6.2 HTML or Markdown
    6.3 MVC or SPA
    6.4 Security
  7. Concluding remarks

5.1丨RSS

RSS (Really Simple Syndication) is an XML-based standard, which is commonly used in content websites including blogs. It was invented by Dave Winer in 1999. Aaron Swartz, a young computer genius, participated in the definition of the specification. Unfortunately, the latter was introduced in 2013. Suicide at the age of 26.

RSS is also one of the most iconic features of the blog system. Its wide application in blogs has become the de facto standard. A blog system without RSS is as interesting as seeing a mobile phone without a camera.

The extension of the RSS file can usually be .rss or .xml, or it does not need to define the extension (such as Moonglade's RSS). The content is the XML description of the recently published blog post, including the title, time, author, classification, abstract (or full text) and other information.
image.png

(Picture: Moonglade's RSS feed)

RSS is written for machines and can be used to synchronize content between websites. For example, Renren.com (former school intranet) can import blog posts as diaries through RSS. For ordinary users, an RSS reader application is needed to subscribe to blogs. Usually such readers not only subscribe to one author's blog, but all blogs that the user cares about. Readers are usually cross-platform and cross-device. Users can subscribe to RSS feeds on computers, tablets, mobile phones, and even Raspberry Pi.
image.png

(Picture: I subscribed to my blog via RSS on the original iPad in 2012)

image.png
(Picture: RSS subscribe to my blog in the latest version of Microsoft 365 Outlook)

Some browsers (such as the early Firefox) can also automatically recognize the RSS address of a blog and subscribe in the browser. The principle of automatic discovery is to find whether there is such a thing in the head of the webpage:

<link rel="alternate" type="application/rss+xml" title="Edi Wang" href="/rss" />

However, RSS has a shortcoming. It cannot be actively pushed by the server to the client, and it needs to be pulled from the server automatically by the client. In the past 10 years, with the rise of mobile terminals, news push services have made up for the shortcomings of RSS, and almost all major platforms have launched their own mobile apps, so RSS has been eliminated by many websites. But it does not mean that RSS is useless. There are still a large number of websites still offering RSS subscriptions. For example, the RSS of the Microsoft Channel 9 TV station: https://channel9.msdn.com/Feeds/RSS/, the RSS of the domestic blog garden: http://feed.cnblogs.com/blog/sitehome/rss, the interesting thing is The logo of the blog site is actually an RSS icon.

For building a blog system, you usually no longer specialize in making a mobile App, and users will not download an App separately for each blog, and the blog system still needs to be synchronized with other blogs and websites. All partners have developed a set of synchronization protocols, and everyone still uses RSS, which is already a recognized standard. Therefore, RSS is still the best way for blogging systems to push articles in 2020.

Reference link:

https://en.wikipedia.org/wiki/RSS

5.2丨ATOM

The functions of ATOM and RSS are almost the same, but the appearance of ATOM is to make up for some design flaws of RSS. For example, for the publication date of the article, ATOM uses the RFC 3339 timestamp, while RSS uses the RFC 822 standard. ATOM can also identify the language of the article, and allow XHTML, XML, and Base64 encoded content not allowed by RSS to appear in the payload.

Many blog systems (including my Moonglade) provide both RSS and ATOM sources.

Reference link:

https://en.wikipedia.org/wiki/Atom_(Web_standard)

5.3丨OPML

"OPML (Overview Processor Markup Language) is an XML format for contours (defined as "a tree where each node contains a set of named attributes with string values"). It was originally developed by UserLand in its Radio UserLand product Developed as a native file format for outline applications in, and has since been used for other purposes, the most common is to exchange web feed lists between web feed aggregators.

The OPML specification defines the outline as a hierarchical structure of arbitrary elements, an ordered list. The specification is quite open, so it is applicable to multiple types of list data.

Mozilla Thunderbird and many other RSS reader websites and applications support the import and export of RSS feed lists in OPML format. "

Reference link:

https://en.wikipedia.org/wiki/OPML

In simple terms, OPML for blogs is to tell readers which feeds the blog has and their respective subscription addresses. Usually, each article category is a feed, and all articles are a feed.
image.png

(Picture: Moonglade’s OPML)

5.4丨APML

APML is Attention Profiling Mark-up Language, it is less known than OPML. APML is currently very rare on the Internet, worse than WP. As one of the historical relics of the blog industry, let me briefly introduce it with feelings.

Similar to OPML, it is also a declaration file in XML format, used to describe things or topics of personal interest, and shared with other readers or bloggers to help readers or the blog system itself provide services for users interested in content Or more targeted advertising.

Reference link:

https://en.wikipedia.org/wiki/Attention_Profiling_Mark-up_Language

WordPress can implement APML through plugins, BlogEngine comes with APML, and my Moonglade does not support APML.

5.5丨FOAF

FOAF stands for Friend of a Friend, and it is also a file written for machines to describe a human social relationship. Usually FOAF can be used in blogs to represent the "friendship link" between the blogger and other blogs, but this friendship link It was written for the machine. So that the machine understands who is your friend, so as to recommend the content in the friend blog to readers.

WordPress can implement FOAF through plugins, BlogEngine comes with FOAF, and my Moonglade does not support FOAF. The status quo of FOAF and APML are similar, and they are almost extinct.

Reference link:

https://en.wikipedia.org/wiki/FOAF_(ontology)

5.6丨BlogML

BlogML is a set of data standards for cross-blog systems. Any blog system that implements BlogML, even if the language and platform are different, can also import and export articles and other data from each other. Just like HTML5 is a standard, Edge, Chrome, and Firefox are browsers, as long as web pages written for HTML5 can run across these browsers.

BlogML was also born in the .NET community and later developed into a standard. In addition to the BlogEngine and other systems that are .NET, WordPress written in PHP supports BlogML. Back then, there were also Windows Live Spaces, Subtext, DasBlog, etc. that supported BlogML. My Moonglade does not support BlogML.

The current standard schema of BlogML is 2.0, which was updated on November 25, 2006. It seems that this standard is also...

Reference link:

https://en.wikipedia.org/wiki/BlogML

5.7丨Open Search

If the blog implements the Open Search specification, then the search function of the blog can be automatically integrated into the user's browser, so that users can directly use your blog's search service as a search engine in the browser address bar (just like Bing and Google) ).
image.png

There are only two parts to implement Open Search. First, add a link to the opensearch definition file in the head of the web page.

<link type="application/opensearchdescription+xml" rel="search" title="Edi Wang" href="/opensearch" />

Then output the opensearch file.

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Edi Wang</ShortName>
<Description>Latest posts from Edi Wang</Description>
<Image height="16" width="16" type="image/vnd.microsoft.icon">https://edi.wang/favicon.ico</Image>
<Url type="text/html" template="https://edi.wang/search/{searchTerms}"/>
</OpenSearchDescription>

The file describes the blog's name, profile, icon, and URL pattern of the search content. Once the browser recognizes this file, it will automatically register your blog in the search engine list. Then readers can directly search for keywords in the browser address bar and display the blog's own search result page.
image.png

(Picture: Search the content of my blog in the address bar)

image.png
(Figure: Search results page)

The specific specifications and standards of Open Search can be found in:

https://en.wikipedia.org/wiki/OpenSearch

5.8丨Pingback

Pingback is used for communication between blog systems. Once your article is quoted by others, you will receive a pingback request, and you will send a pingback request to the other's blog when you quote other people's articles. Therefore, completing a Pingback requires your own and the other party's blog Support the pingback protocol together. Because it is a standard protocol, pingback does not require both blogs to use the same blog product. For example, Moonglade written in .NET Core can ping each other perfectly with WordPress written in PHP. Pingback also does not limit the type of website that must be a blog. Any CMS or content website that wants to support Pingback is fine.

The technical principle of Pingback is not complicated either.

Send a Pingback request:

Get the URL A of your own article, the URL B of the cited article on the opposite side, and request B to see if it has a pingback terminal. If so, construct an HTTP Request with a piece of XML:

<methodCall>
       <methodName>pingback.ping</methodName>
       <param>
              <param><value><string>A</string></value></param>
              <param><value><string>B</string></value></param>
       </param>
</methodCall>

In this way, the website where B is located knows that the article A refers to the article B, and after processing the pingback, it will give the website where A is located a success or failure response.
image.png

(Picture: Moonglade's pingback terminal)

Accept Pingback request:

Your own article URL A was quoted by someone else's article B, and received a pingback XML. First of all, you need to verify whether someone else’s pingback request looks strange to ensure security, such as whether there is a normal methodName, whether there is a legitimate URL for both parties, whether the URL can be accessed normally, whether there is a strange URL (such as localhost or a potential attack) Special construction of behavior). After ensuring that the pingback request is okay, request B's page, grab the title content of B's webpage, and B's IP address, record it in its own database, and associate it with A's article.

The received Pingback is usually automatically commented under the article as a system, but this design is not one of the specifications, you can play freely. For example, Moonglade centralized the pingback in the background for the blog administrator to view.

image.png
(Picture: In Moonglade's back-end management, check which websites refer to your blog's articles)

Reference link:

https://en.wikipedia.org/wiki/Pingback

5.9丨Trackback

Trackback allows one website to notify another website of updates. This is one of the four types of linking methods for website authors to request notification when someone links to one of their documents. This allows authors to track who links to their articles.

Reference link:

https://en.wikipedia.org/wiki/Trackback

Although the function is similar to Pingback, Trackback usually needs to be sent manually and an abstract of an article needs to be provided to the other party. The Pingback process is a fully automatic operation completed by the blog systems of both parties.

5.10丨MetaWeblog

MetaWeblog is a set of Web Services based on XML-RPC. This set of API defines several standard interfaces for CRUD of regular blog content such as articles, categories and tags. As long as the blog system with these interfaces is implemented, bloggers can use the client installed on the computer to write blogs instead of logging in to the blog background through a browser to write articles. Mainstream clients include Windows Live Writer and Microsoft Word. In the client, you can completely edit articles, insert pictures, set categories, and even synchronize blog topics to the client.

It may look like one of the outdated blogging protocols, but until today in 2020, the latest version of the Microsoft 365 suite still fully supports the blog system that implements the MetaWeblog API.

image.png
(Picture: Microsoft Word blog support)

Blog APIs similar to MetaWeblog include Blogger API, Atom Publishing Protocol, and Micropub.

Reference link:

https://en.wikipedia.org/wiki/MetaWeblog

My blog implemented MetaWeblog + RSD in 996 007 in 2012, but now I’m 30 years old, and I don’t plan to implement this in .NET Core for the time being. After all, how many people are still blogging with Live Writer and Word (crying.

5.11丨RSD

Really Simple Discovery (RSD) is an XML format and a publishing convention used to make services exposed by blogs or other Web software discoverable by client software. This is a way to reduce the information needed to set up editing/blogging software to three well-known elements: username, password, and homepage URL. Any other key settings should be defined in the RSD file associated with the website or can be discovered using the information provided.

In order to use RSD, the owner of the website places a link mark in the head of the homepage to indicate the location of the RSD file. An example used by MediaWiki is:

<link rel="EditURI" type="application/rsd+xml" href="https://en.wikipedia.org/w/api.php?action=rsd" />

Then use RSD files to represent the interfaces of various APIs.

<?xml version="1.0"?>
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
    <service>
        <apis>
            <api name="MediaWiki" preferred="true" apiLink="http://en.wikipedia.org/w/api.php" blogID="">
                <settings>
                    <docs xml:space="preserve">http://mediawiki.org/wiki/API</docs>
                    <setting name="OAuth" xml:space="preserve">false</setting>
                </settings>
            </api>
        </apis>
        <engineName xml:space="preserve">MediaWiki</engineName>
        <engineLink xml:space="preserve">http://www.mediawiki.org/</engineLink>
    </service>
</rsd>
Reference link:

https://en.wikipedia.org/wiki/Really_Simple_Discovery

RSD is also almost used with the MetaWeblog interface above. In this way, tools such as Windows Live Writer and Microsoft Word can automatically discover the MetaWeblog service of the blog, without the need to manually enter the URL.

5.12 Reader view

Most browsers and clients have a reader view, which allows readers to read articles in a view that is completely different from the style of the blog site page. For example, the normal page of an article on my blog looks like this:
image.png

(Picture: Moonglade non-reader view article page)

When the browser recognizes that my blog supports reader view, the immersive reading button will light up.

image.png

(Picture: Microsoft Edge browser immersive reading button)

After entering the immersive reading interface, the browser will automatically extract the content of the article, identify the title, chapter, and picture of the article, remove the navigation bar, sidebar and other elements that are not related to the article, and allow the user to control the text size and background color. Even read the content of the article aloud.

image.png
(Picture: Moonglade's article enters the immersive reading interface)

Not only my blog has a reader view, but also well-designed blogs and news content sites, such as Azure:

image.png
(Figure: Azure official blog reader view)

In addition, SEO will not be bad for websites that support reader view. Therefore, when designing a blog system, please consider supporting the reader view.

Tomorrow will mainly introduce [What are the knowledge points of designing a blog system]
Please continue to lock us!


Scan the QR code to follow Microsoft China MSDN to get more first-hand technical information and official learning materials from Microsoft!
image.png


微软技术栈
423 声望996 粉丝

微软技术生态官方平台。予力众生,成就不凡!微软致力于用技术改变世界,助力企业实现数字化转型。