Make mobile permalink use `ref` for baselayers

Should fix #830 & #831