Way to construct urls to open in Gospel Library app?

Any discussions around the Gospel Library App on various mobile and electronic devices.
pianoman730
New Member
Posts: 2
Joined: Fri Sep 04, 2020 12:20 pm

Way to construct urls to open in Gospel Library app?

Postby pianoman730 » Fri Sep 04, 2020 12:39 pm

I'm developing an app related to the Book of Mormon that will have references to scriptures. I want to be able to click on a link and open the particular scripture in the gospel library app. I can do this in the format of `Alma 3:2-3`, but when I get into multiple sets of ranges of verses, it will open the browser instead of gospel library. `Alma 3:2-3, 5-16`. How can I construct a url to open this in the gospel library app?

User avatar
sbradshaw
Community Moderators
Posts: 5240
Joined: Mon Sep 26, 2011 8:42 pm
Location: Utah
Contact:

Re: Way to construct urls to open in Gospel Library app?

Postby sbradshaw » Fri Sep 04, 2020 1:26 pm

The current preferred way is to use a "universal link" that works in both a web browser and the app, like this:
https://www.churchofjesuschrist.org/study/scriptures/bofm/alma/3?id=p2-p3,p5-p16&lang=eng#p2

Using a universal link allows the user to choose if they want to use the site or app, and it provides a good experience if the link is tapped/clicked on a device that doesn't have Gospel Library installed. It works for Android and iOS Gospel Library (I'm not sure about Windows Gospel Library – but if not, it will fall back to the browser).

If you want to force the link to open in the Gospel Library app only, you can use this older format (it will fail if the app isn't installed):
gospellibrary://content/scriptures/bofm/alma/3.2-3,5-16#2
Samuel Bradshaw • If you desire to serve God, you are called to the work.

pianoman730
New Member
Posts: 2
Joined: Fri Sep 04, 2020 12:20 pm

Re: Way to construct urls to open in Gospel Library app?

Postby pianoman730 » Fri Sep 04, 2020 9:23 pm

@sbradshaw Awesome, this is exactly what I was looking for. I didn't know the right way to construct the arguments for the url. Is there any documentation around the url? I've seen another argument on the end sometimes: <url>lang=eng#p2#2
That extra #2 was what I wasn't sure about. I just wanted to make sure there wasn't anything else that I was missing. The example you gave should definitely be sufficient for our needs but I was just curious.

User avatar
sbradshaw
Community Moderators
Posts: 5240
Joined: Mon Sep 26, 2011 8:42 pm
Location: Utah
Contact:

Re: Way to construct urls to open in Gospel Library app?

Postby sbradshaw » Tue Sep 08, 2020 12:15 pm

There isn't documentation online anywhere, unfortunately... I think #p2#2 is a bug (most likely the browser will ignore the second hash symbol and everything that follows it).

The "id" parameter indicates which paragraph(s) or heading(s) to call out on the page with a bar in the left margin. You can get the IDs for paragraphs by looking for "id" attributes on the HTML elements in a web inspector. If the id parameter is left off, nothing will be called out on the page.

The "lang" parameter indicates which language of content to go to. If the lang parameter is left off, the link will open in the browser language (web) or current content language (app).

The "#" indicates where on the page to jump / scroll to, after it loads. Usually this is the first paragraph that's called out with a bar, but it doesn't necessarily have to be. If the # is left off, the page will load scrolled to the top.

The same URL pattern should work for all content under https://www.churchofjesuschrist.org/study.
Samuel Bradshaw • If you desire to serve God, you are called to the work.


Return to “Gospel Library”

Who is online

Users browsing this forum: No registered users and 1 guest