I currently have a desktop version of my website. I don't want to change that. But I thought about adding a mobile friendly website. For this website, I would remove some HTML elements to make it load faster (e.g. a tag cloud and some images) and change the style to use screen space better.
I would like to use a subdomain for that, e.g.
http://martin-thoma.com/check-point-inside-polygon/ # Desktop verson
http://m.martin-thoma.com/check-point-inside-polygon/ # Mobile version
How can I use both, a subdomain m.
and my domain with GitHub pages?
The other question is a more about Jekyll. I don't know how this should be on the underlying file system. I think it could be like this
./css/
./images/
./_drafts/
./_posts/
./_plugins/
./_site/
|- ./css/
|- ./images/
|- ... (all posts, tags, titles)
|- ./m/
|- ./css/
|- ./images/
|- ... (all posts, tags, titles)
So I would basically need two jekyll runs. The first one generates the desktop site, the second one the mobile site. But how can I tell jekyll to use a different layout for the same posts? (Of course, I could preprocess my posts and replace all layout:desktop
occurrences by layout:mobile
, but that does not feel right.)
So my question is: How does Jekyll deal with different mobile / desktop site versions? Are there examples, that don't solve it solely by media="handheld"
or media="only screen and (max-device-width: 480px)"
(media queries)?
I think the way Wikipedia does it is quite nice. When you emulate a mobile device and look at the HTTP-requests, you will notice the following:
Request URL:https://de.wikipedia.org/wiki/Benutzer:MartinThoma
Request Method:GET
Status Code:302 Found
Request Headers
GET /wiki/Benutzer:MartinThoma HTTP/1.1
Host: de.wikipedia.org
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Accept-Encoding: gzip,deflate,sdch
Accept-Language: de-DE,de;q=0.8,en;q=0.6,en-US;q=0.4
Cookie: uls-previous-languages=%5B%22de%22%5D; clicktracking-session=SOME_SESSION_VAR; wikimedia-SUL-final-CN-general=5; mediaWiki.user.sessionId=MY_USER_ID; dewiki_session=ANOTHER_SESSION_ID; dewikiUserID=ANOTHER_USER_ID; dewikiUserName=MartinThoma; dewikiSession=ANOTHER_SESSION_ID; centralauth_User=MartinThoma; centralauth_Token=BLA; centralauth_Session=BLA; forceHTTPS=1; centralnotice_bucket=0-4.2; wikiEditor-0-toolbar-section=advanced; vector-nav-p-lang=true
If-Modified-Since: Thu, 09 Jan 2014 05:14:25 GMT
Response Headers
HTTP/1.1 302 Found
Server: nginx/1.1.19
Date: Thu, 09 Jan 2014 05:14:53 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Location: https://de.m.wikipedia.org/wiki/Benutzer:MartinThoma
Accept-Ranges: bytes
X-Varnish: 161481560
Age: 0
Via: 1.1 varnish
X-Cache: amssq57 frontend miss (0)
Cache-Control: private, s-maxage=0, max-age=0, must-revalidate
So they seem to use the User-Agent
to determine which site they will give you. I think I can do the same with .htaccess
files (see Mobile Redirect using htaccess). But I still would have to have this mobile version of the site.
display:none
or something similar, but I really want a distinct mobile website. – Voucherif (not_on_mobile) { render_cloud }
? – Selmnerdisplay:none
solution? I think that the JS solution would even mean more to load than the CSS solution. But at least it would also have to load the HTML. But I want to create a very minimalistic mobile website to reduce load times. – Voucher_layouts
) with Jekyll". You've already answered the github-part of the question, now I'm still not too sure about the Jekyll-part. – Voucher