Formatting url to search for specific verses

19 postsstarted by corwinslack 10,260 viewsoriginal topic

#1
If I know the verse I want to find how do I format the url? I am trying to code the url in another app.
(E.g. I input 1:Cor. 1:21-25 and the search returns that page with the reference highlighted and a well formed url to paste into a hyperlink.
Thanks
Community Moderators
#2
This is the current format for scripture references:
https://www.lds.org/scriptures/nt/1-cor ... ng=eng#p21
  • https://www.lds.org OR gospellibrary://content – LDS.org or the Gospel Library app.
  • /scriptures – section of LDS.org or content type.
  • /nt – testament / work / volume of scripture (ot / nt / bofm / dc-testament / pgp).
  • /1-cor – scripture book.
  • /1 – chapter.
  • ?verse=21-25 – verse(s) to put a callout box around, optional. If not specified, no callout boxes will be drawn. This can be a single verse, a range, or a series (for example, "2-5,7" is valid).
  • &lang=eng – language, optional. If not specified, link will default to the browser/device language (which could give an error if the content doesn't exist in that language).
  • #p21 – verse to scroll to, optional. If not specified, chapter will load to the top.
Samuel Bradshaw • If you desire to serve God, you are called to the work.
#3
If you go to scriptures.lds.org you can see a field that allows search criteria. If you entered 1 Cor. 1:22-25 in that field it would navigate to a url very similar to what you defined. I want to know how to format a url to feed the form not how to format the url it finds. I suppose it will have a GET in it but my skills at HTML queries are inadequate.
Community Moderators
#4
If you go to LDS.org/scriptures, then disconnect your internet connection (to prevent redirects), then type a reference in the scriptures search box and press enter, you can see what URL the form tries to load. For 1 Cor. 1:21–25, this is what I got in the address bar:
https://www.lds.org/scriptures/search?l ... 25&x=0&y=0

I'm not sure what the x and y parameters do – I think they can be removed. So:
https://www.lds.org/scriptures/search?lang=eng&query=[url-encoded scripture reference]
Samuel Bradshaw • If you desire to serve God, you are called to the work.
#5
This is good but no better than just formatting it. The must be an HTML FORM and a GET method that will accept the string "1 Cor. 1:21-22".

I am trying to get the system to perform the URL formatting for me.
Community Moderators
#6
What are you hoping for it to return? A JSON file of some sort?
Samuel Bradshaw • If you desire to serve God, you are called to the work.
Senior Member
#7
corwinslack wrote:This is good but no better than just formatting it. The must be an HTML FORM and a GET method that will accept the string "1 Cor. 1:21-22".

I am trying to get the system to perform the URL formatting for me.
Based on the query parameters the form should be something like this (I haven't tested this so the it may be missing details but the gist should be right):

Code:

<form action="https://www.lds.org/scriptures/search" method="get">
  <input type="hidden" name="lang" value="eng"></input>
  <input type="text" name="query"></input>
</form>
#8
Thanks! Which of those fields gets my input string 1 Cor. 1:21-24 ?
#9
Would it be something like

<input type="text" name="query" value="1 Cor. 1:21-24"></input>
Senior Member
#10
corwinslack wrote:Thanks! Which of those fields gets my input string 1 Cor. 1:21-24 ?
Only one of those fields will show up on the screen (name="query" type="text"). That's the one where the input string is entered. The other (name="lang") is hidden and is just there to add the language to the URL.
#11
Here is the answer

Https://www.lds.org/scriptures/search?l ... 20-22%2C24

The spaces in the string 1 Cor 1:20-22,24 need to be replaced with +. The colon needs to be replaced with %3A. And the comma needs to be replaced with %2C

- (dash) apparently does not need to be replaced.

Thanks for the nudge. It helped me go the right direction. The Inspector in Google Chrome is fantastic. I wish I understood 1% of it.
#12
Here is what comes after the ?

lang=eng&query=1+Cor+1%3A20-22%2C24
#13
This seems to work as well but I need to test it.

lang=eng&query=1%20Cor%201:20-21,24
#14
Tested and will continue to test. A lot of encode url encode methods will return the second version if 1 Cor 1:20-21,24 is entered.

(Sorry about the inconsistency over verse 22 and 22. It is not significant).
New Member
#15
When I click on

https://www.lds.org/scriptures/nt/1-cor ... ng=eng#p21

my web browser changes the address to

https://www.churchofjesuschrist.org/stu ... 1?lang=eng,

which eliminates the blue bar marking specific scriptures and the scroll feature. If I try and manually type in the "verse=21-25" and then proceed my browser corrects it to the latter link. How do I stop my browser from changing the link?
Community Moderators
#16
This looks like a bug – I'd recommend sending it as feedback. There is a newer format for URLs – this is what the Gospel Library app outputs when sharing:
https://www.churchofjesuschrist.org/stu ... ng=eng#p21
but that doesn't work either (it still redirects).
Samuel Bradshaw • If you desire to serve God, you are called to the work.
New Member
#17
Is there a reason that you do not have a share icon that would then link to a modal window where the visitor could then choose the verses and how they want to share it and then hit go or copy or whatever?

This is very simple and would make sharing the gospel sooo mich easier.
Community Moderators
#18
scrupply wrote:Is there a reason that you do not have a share icon that would then link to a modal window where the visitor could then choose the verses and how they want to share it and then hit go or copy or whatever?

This is very simple and would make sharing the gospel sooo mich easier.
I'm not sure exactly what you're looking for, but you can already choose what to share and where to share it – just select the text you want to share, then tap the Share button on the annotation menu that appears. It will give you options for where to share to.
Samuel Bradshaw • If you desire to serve God, you are called to the work.
New Member
#19
Anyone know why the top link, when emailed by the management email, does not work. I am getting a 404 error.