Skip to end of metadata
Go to start of metadata

The Geolocation module will add localized content to a site with these steps:

  1. Capture the IP address of the user.
  2. Use an API like ipinfodb.com to convert this into the name of the city and state where the user is.
  3. Use the name of the city and state to search the content database for articles containing the city's name.
  4. Create a block listing these articles.
  5. Load this block into a page with an AJAX call to make the page load faster.

The first three steps will be done with a model object and the second two will be handled by Freemarker templates.

Related pages
Page: Geolocation module
Page: Geolocation module instructions
Page: Geolocation tutorial — how to detect the visitor's geographical location using a public geo-API
Page: Geolocation tutorial — how to detect the visitor's geographical location using a public geo-API
Page: Geolocation module instructions

Labels
  1. Jun 13, 2012

    If I understand well, you want to create a component/paragraph that aggregates content based on the location information of the user.

    • Please defined the version of Magnolia, I recommend 4.5.
    • Will your module extends STK?
    • You want to do the step 1/2/3 on the server side, but I quickly checked ipinfodb.com and it provides only client side detections, please enumerate geolocation
      possibilities.
    • About the list of articles, please detail this part.
      Do you want to trigger a search that looks for content containing "the city" and "the state" or is it something more advanced?
    • If we do everything on the server side, I dont see the need of an Ajax load. When you request a page containing this component, the list of articles will be automatically displayed.
    • In term of design, try to separate the geolocation logic and the search. Then later it will be more easy to extend this component and use the geolocation logic for another purpose.

    Thanks to detail a bit more (wink)

    1. Jun 13, 2012

      • We'll be working with both 4.4 and 4.5, but the goal is to hit 4.5.
      • There's no plan to extend STK now, but I'm open to it if you think it can add some functionality.
      • 1/2/3 need to be done on the server side because the client can only call the original source of the web page. The server can get the IP address from the header and act as a proxy for the client.
      • At this point, it's just a plan to search for the city and state name.
      • The speed of the IP lookup can be a hurdle for the page assembly. If that is not available, it can lock up the page creation. Loading the block afterwards avoids this bottleneck.
  2. Jun 13, 2012

    Hi,

    Samuel mentioned on the Geolocation Tutorial Page using a geolocation API and HTML5 data storage for mobile templating within the STK. On the client-side the STK already includes Webshims lib that provides polyfills for geolocation as well as storage and JSON. I think these could come in handy with the integration. Thoughts?

    Cheers,
    Matt

  3. Jun 14, 2012

    Peter,

    • working with both 4.4 and 4.5? I think it makes more sense to focus on the latest version 4.5 where features like instant mobile site and multichannel management are emphasized.
    • by extending STK I dont mean adding new components directly into STK, I speak about the extends mechanism that let you re-use features from STK and change it regarding your needs.
      It will mean also that this module requires that STK is installed and also the components will be only working in a "STK-based" website.
      And finally as said Matt, STK comes with a set of JS scrips files that will be useful in this case, again another reason to extend (or to be dependent) on STK.