Jump to content

how to build a mobile website with another template?


leoric
 Share

Recommended Posts

hi,everyone.

today i have a question need help.

this is my application background story: 

my site domain is abc.com and i need a mobile website  use  m.abc.com   

(this is a seo suggestion from baidu.com )

they are connect to same database , just have their own difference template.

is anyone have any idea?  thanks.

Link to comment
Share on other sites

While that's one way of dealing with a mobile site, the other way would be to use a mobile-first front end framework (such as Bootstrap 3 or Zurb Foundation 4/5) and develop your site at your abc.com domain.

I would be very interested to know why Baidu thinks (for SEO purposes)  that the separate mobile site is better than a consolidated website (mobile and responsive) at the same domain.

  • Like 4
Link to comment
Share on other sites

While that's one way of dealing with a mobile site, the other way would be to use a mobile-first front end framework (such as Bootstrap 3 or Zurb Foundation 4/5) and develop your site at your abc.com domain.

I would be very interested to know why Baidu thinks (for SEO purposes)  that the separate mobile site is better than a consolidated website (mobile and responsive) at the same domain.

hi, cstevensjr and Marty Walker

thank you for your reply

i have been think so before,i even think its unreasonable. but in the fact it done.  

baidu highly recommended webmaster build mobile website. and them made a tool to online building mobile site (siteapp.baidu.com)

unfortunately our chinese language website have a large proportion of traffic from baidu search. so we have to  comply with official seo suggestion.

i think baidu have two independent systems(pc and mobile).

i do this if there have a good solution.

Link to comment
Share on other sites

Another approach would be to have a duplicate of your template folder where you use diffferent code inside your templates. I use this a lot for development in a live site, but its an easy solution to use it for a mobile website too.

When your normal site is finished (or while developing) make a duplicate of the template folder and name it "templates-mobile". The goal here is to have exactly the same template files in both folders.

Paste the following code at the bottom of the /site/config.php file and change the m.domain.ext to your needs

if($_SERVER['HTTP_HOST'] == 'm.domain.ext') {
    $config->urls->templates = '/site/templates-mobile/';
    $config->paths->templates = $rootPath . $config->urls->templates;
}

This way when you visit your website on m.domain.ext it will use the templates out of the templates-mobile folder while it still uses the same data from the database, assets folder and the modules.

  • Like 10
Link to comment
Share on other sites

If all you want is to comply to baidu suggestion, just make a responsive site in abc.ext and point m.abc.ext to it like you probably did with www.abc.ext

  • Like 4
Link to comment
Share on other sites

Another approach would be to have a duplicate of your template folder where you use diffferent code inside your templates. I use this a lot for development in a live site, but its an easy solution to use it for a mobile website too.

When your normal site is finished (or while developing) make a duplicate of the template folder and name it "templates-mobile". The goal here is to have exactly the same template files in both folders.

Paste the following code at the bottom of the /site/config.php file and change the m.domain.ext to your needs

if($_SERVER['HTTP_HOST'] == 'm.domain.ext') {
    $config->urls->templates = '/site/templates-mobile/';
    $config->paths->templates = $rootPath . $config->urls->templates;
}

This way when you visit your website on m.domain.ext it will use the templates out of the templates-mobile folder while it still uses the same data from the database, assets folder and the modules.

Raymond Geerts,you are a great help.  thank you!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...