danielthepope / trntxt

:steam_locomotive::train::train: A data-friendly UK train times site
https://trntxt.uk
MIT License
36 stars 9 forks source link

Modify content of meta tags depending on user agent string #17

Closed danielthepope closed 9 years ago

danielthepope commented 9 years ago

When a request comes in, inspect the user agent string to work out the device that is accessing the page. Based on that, you can decide which icon metadata to insert into the page.

First I want to see which devices load which icons (without any modification). On each request, log the UA string and the path of the file it requested.

Then, using the UA string, determine the type of device / browser in use and set a variable called device, with the value:

Jade can look at the value of a variable and add content based on it. I can't remember the syntax right now but before each meta statement you can check the condition of a variable and get it to write the line if that condition is true.