[ckan-dev] redirect homepage (like on data.gov)

Vitor Baptista vitor at vitorbaptista.com
Mon Mar 3 20:19:11 UTC 2014


Hi Reinier,

I did this for the Mexican instance. Check in
https://github.com/okfn/ckanext-mx/commit/8c89f696412da618ca1ddea6a04eaad25d5a1e7d
.

Basically, you need to implement plugins.IRoutes in your theme (or any
other plugin), and do:

def before_map(self, m):
>     m.redirect('/', '/dataset')
>     return m


Cheers,



2014-02-20 15:36 GMT-03:00 Reinier Battenberg <
reinier.battenberg at mountbatten.net>:

>  Hi,
>
>
>
> I would like to redirect our homepage to /dataset, like http://data.govredirects to /dataset
>
>
>
> I tried a few tricks on theme level but i cant figure out/google the 3
> lines of code that can do the trick.
>
>
>
> (i checked their extentions here:
> https://github.com/ckan/ckan/tree/release-datagov/ckanext but none of
> them says: ckanext-redirecthehomepage, i also searched the full repo on
> redirect, so i figured, somewhere I have to do either
>
>
>
> (in pylons)
>
> redirect_to(controller='packages', action='dataset', _code=301) }}
>
>
>
> in pure python:
>
>  map.redirect('/packages', '/dataset')
>
>
>
>
>
> I think that is where my python/ckan knowledge ends. (for now)
>
>
>
> Anyone can give me a quick pointer?
>
>
>
>
>
> --
>
> rgds,
>
>
>
> Reinier Battenberg
>
> Director
>
> Mountbatten Ltd.
>
> www.mountbatten.net
>
> tel: +256 758 801749
>
> twitter: @batje
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>


-- 

Vítor Baptista

Developer  |  http://vitorbaptista.com |
LinkedIn<http://www.linkedin.com/in/vitorbaptista>|
@vitorbaptista <http://twitter.com/vitorbaptista>

The Open Knowledge Foundation <http://okfn.org>

*Empowering through Open Knowledge*

http://okfn.org/  |  @okfn <http://twitter.com/okfn>  |  OKF on
Facebook<https://www.facebook.com/OKFNetwork> |
Blog <http://blog.okfn.org/>  |  Newsletter<http://okfn.org/about/newsletter/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140303/71a772b6/attachment-0002.html>


More information about the ckan-dev mailing list