factorizing permanent URL generation