Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

モバイル向けテーマ導入の変遷

古い記事をメンテしていたら、モバイル向けテーマ導入の記事がいくつもあり、何度も試行錯誤してきたことがわかりました。面白そうなのでちょっと歴史をたどってみました。

一番古いのは以下の記事で、2009年1月の記事です。

モバイル用のテーマを入れる

HT-03A が発売されたのが2009年7月なので、このころはまだ SH906i を使っていました。Drupalでサイトを作り始めるとどうしても携帯電話からアクセスしたくなり、Drupalのモジュールを使った最初の試みです。

UAを見てテーマを変えるというもので基本的な考え方はこの頃からずっと変わっていません。これ以前に PCサイト->携帯変換スクリプト というツールを使ってみたこともありますが、これだとアクセスするURLが別のものになってしまうのがよくないなあと思っていました。その頃からURLもページを記述するHTMLも共通にしておいてDrupalでいうところのテーマを変えるだけという仕組みがよいと思っていました。

これは今でいうレスポンシブ・ウェブデザインというもののようで、Googleもこの方式を推奨しています。

http://googlewebmastercentral-ja.blogspot.jp/2012/06/google.html

その次に試したのが mobile theme というモジュールです。

Drupalのモバイル用のテーマを入れる (その2)

2009年3月のことです。UAの判定を行ってテーマを切り換えるというモジュールはいくつも出てきていました。いろいろなモバイル用テーマを試してみてまあ面白かったのですが、実際にはそれほど使いませんでした。また、iモードからのアクセスだったのでセッション管理ができないためログインして作業することはできませんでした。

次に Mobile Themeをやめて SwitchThemeを使って見ました。2010年2月の記事です。

Mobile用テーマへの切り換えリンク

このころは Android端末を使っており、モバイルからのアクセスも自分のためというより他の人にも見てもらうために変わりました。

ユーザがモバイル向けとPC向けのテーマを切り換えられるようにテーマ切換用のリンクを用意しました。このころはモバイルでも同じURLにアクセスして自動でテーマを切り換えるようにしていました。

最新の設定はこちらです。

Mobile Tools によるモバイル用テーマ切り換え設定

Mobile Toolesというモジュールを使っています。2011年2月の記事ですのでNexus Oneを買って1年半が過ぎた頃です。この頃はスマートフォンからのアクセスにもきちんと対応しなければならないという風に意識が変わってきた時期です。

一旦はうまくいったように思えたのですが、Mobile Toolesで同一URLへのアクセスに対してテーマ切換を行う方法はBoostモジュールのキャッシュと併存できないことがわかり、同一URLへのアクセスをあきらめました。

2011年8月に独自ドメインを取得し、モバイル用のサイトとして同じページにモバイル用 URLでアクセスできるようにしました。
そのあたりの設定はこちらに簡単に書きました。

作業メモ:モバイル用に m.nyanchew.com というurlを設定した

URLは別ですが、モバイルからPC向けURLにアクセスしたときには m.nyanchew.com に自動的にリダイレクトするように .htaccess を設定していますので、特にURLを意識しなくてもよいようになっています。

今の状態ならまあまあいいかな、と思っています。

PAGE TOP