How to automatically add a mobile version of your blog post (currently only supports blog Park)

Source: Internet
Author: User

Objective

Since 2005, I have been writing the first technical blog, and I am one of the first batch of technical bloggers in China. It has been interrupted for some time, but after the 2008 re-activation, the habit has been retained until now, and the number of articles already accumulated has reached 1226. Most of these articles are original, reproduced with special note, the article is mostly their own actual work encountered problems and solutions, or I do consulting services for enterprises, training services to solve the problem, I especially like to solve the problem after doing a little summary, and organized into a blog post to share, One is to re-comb the thinking, but also hope that in the future may be helpful to others.

Over the years, as mobile internet has become more mainstream, I've been involved in some mobile web development practices, and I've been thinking about how to make these blog posts better to read on mobile devices. Technically speaking, the PC version of the browser, because the screen is wider, so easier to read the blog post, and the same Web page on the phone, the effect will be much worse.

As you can see, if you don't do anything, the mobile browser simply shrinks the page proportionally. The result is that the font is very small and difficult to read. But wouldn't it be better if it was like this?

From the practice of these years, I concluded that mobile Web pages should have several features

1. Font slightly larger, content should be filtered to remove interference elements, so that users can focus on content

2. The layout should be adapted to the width and height of the mobile device.

3. Interactive mode should take into account that the user is using touch, not with the mouse. Links and buttons should be visible.

4. Do not allow users to enter content too much

So, the website's mobile actually involves the redesign of the page layout. Fortunately, there are some better frameworks for mobile web development. I highly recommend the jquerymobile. Please refer to the official website:

Solution Solutions

It took a little bit of time to get up this morning and to do a feature that would directly convert the blog post to the version of the phone. The way to use this is:

1. Find the address of the blog post you want to convert, such as http://www.cnblogs.com/chenxizhang/archive/2013/05/20/3088196.html

In the PC version the browser looks like the following

2. By adding a prefix (http://webfeed.azurewebsites.net/home/displayonlineblog?url=) in front of this address, that is, the full address is:/http webfeed.azurewebsites.net/home/displayonlineblog?url=http://www.cnblogs.com/chenxizhang/archive/2013/05/20/ 3088196.html. If you have a friend who has been a developer of MVC, I know that this is a special action I designed. In fact, the function is not difficult, is to download the original content of the blog, and then re-format with the framework.

"Important" to note is that I do this feature will automatically identify the browser, if you are still using the PC version of the browser to open the above mentioned address, then the interface will be seen below so

But if you really use a mobile device, such as a mobile phone, you'll see the following effect

It is worth saying that I did not simply change the deployment, the content elements of which will have some special treatment. For example, for pictures, I'll add a style sheet that will allow them to automatically adapt to the size of the phone screen. (Even if it is actually very large in width). At the same time, for the blog post some internal links (links to any other blog Park article), will automatically change the link to the mobile version of the address, the attentive friend can see in fact the link address is replaced.

The method mentioned above, very simple and practical, you can use this address format without any restrictions, for your blog post automatically "Generate" a mobile version, you can share these links to your friends, so that they can better browse your article on mobile devices.

Notes Everyone can be interested in webfeed.azurewebsites.net this website, this is my recent Enterprise Training Practice Program (people have not completely finished), this site shows how to integrate the PC version of the browser and mobile browser (mentioned above, they will have different layout and interactive function), the use of technology The operation is ASP. 4 + jQuery Mobile + Knockoutjs, etc. This site is hosted in Microsoft Azure, and I'm currently using the free mode, which may sometimes be slow. Please forgive me.

"Remarks" I will always keep this site.

Solutions for improvement

I quickly realized that the address above was a bit complicated, and it seemed a little cumbersome to get you to splice the address every time. So I thought of a way to make these pages open, automatically generate a good mobile version of the link? Thanks to JavaScript, we can do that.

First, you can enter your blog management background

You can put the following script reference in any location you want.

<script src= "Http://webfeed.azurewebsites.net/mobilelink.js" ></script>

For example, I was placed at the top of the page

After you save your settings, a link appears automatically at the top of any blog post, as shown in

"Remarks" Your blog home page, because it is not an article, so actually after clicking, will not produce specific content

If you open a specific blog post, that link will work.

By the way, if you want to better search all my blog posts, you can visit http://webfeed.azurewebsites.net directly

The effect on the phone-side access is the following

This site has even been integrated into the inside, if interested, you can add dev2db this public number, directly inside can search for blog posts, for details, please refer to the following article

http://mp.weixin.qq.com/s?__biz=MjM5ODEyNjE5OA==&mid=200117429&idx=1&sn= 239ab455e80f4bfe1ac5bdeb9c94d41b#rd

Above, I hope to help you, if you have a better approach, also welcome to share.

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.