Closed ghost closed 3 years ago
Is It addressable inside GitHub?
I'm not sure I understand your question, can you restate or elaborate?
Yes.
In the HTML doc the subpart of the doc are accordions without document fragments like /doc#the-ninth-service
so if I want to mention a service i have to say "Go to this URL and scroll until Your eyes matches the title <title-here>
".
So I suggested to split the doc in several urls or HTML Pages.
I'm sorry too I'm not native speaker and a write quickly. 👍
No problem. I understand what you're asking now.
You can supply a link that opens a specific part of the page by adding /#id_of_h1_element
to the URL of api.nasa.gov
Examples are: https://api.nasa.gov/#donki https://api.nasa.gov/#insight https://api.nasa.gov/#apod https://api.nasa.gov/#eonet
The way this works is #
signals to your browser to look for a h1 element in the HTML of the page at that URL with the ID of the text that comes after.
Hence, it looks for <h1 id="eonet">
on https://api.nasa.gov
if you put into your browser address bar https://api.nasa.gov/#eonet
The name of the ID will always be lower case and one word.
If using the first word of the visible API name doesn't work, you can try using developers tools to look at the HTML of the page and find the actual ID of the H1 element you want the page to open to.
Does this cover what you're requesting?
It enables you to supply your users with a direct link to the details for a particular API but doesn't require any changes to the api.nasa.gov page.
The general behavior for how/why this works is covered here: https://www.w3.org/TR/html401/struct/links.html
Thanks. There are 2 new issues in the following referenceable comments.
If i visit https://api.nasa.gov/#eonet i don't see "EONET..." because is z-indexed under the header or viceversa. I have to scroll a little bit.
If i visit https://api.nasa.gov/#donki sometimes i see
But if i refresh i see
Why sometimes? Because even when I visit the second time the page the rendered view Is the top of the page. I don't know well how ti reproduce but in general seems that the anchor works only if the page Is not cached or anyway visited for the first time.
I can try to screencast the thing of needed.
I see what you mean. Sometimes the behavior is fine and sometimes it isn't. I think it is a state issue.
I've added a small script at the bottom of the index.html page that now looks at the URL and sees if there is a /#id_name
at the end, if there is, it triggers an artificial click on the element with that as its id. I've added a 4 second time out just so it always works even if someone's download speeds are slow.
Does that work for you?
Yes, it worked, but you still see the top of the page for a moment and you don't understand if you can interact or not, while with the standard behavior it seems to me that the browser renders the document fragment directly.
If the html in question is in the body of the first http call, the browser should have what it needs to render.
This works pretty well for me https://developer.mozilla.org/en-US/docs/Web/API/Location/hash#Examples
What you suggest is basically what I did initially. It worked locally but not when I pushed it into production.
I think the issue is the way the page is built that whole section gets pulled in via a script and is not in the html written in the index.html file. I added the time out to ensure the script to "click" the element in question didn't run until after the script to add in the html run.
It runs and is only a tiny bit slower, so I'm inclined to keep it as I have some other things to work on.
However, if you want to submit a pull request that changes the scripts at the bottom of index.html such that they are called in a specific sequence that would probably minimize the brief pause before the page opens the relevant section and is a better solution in any case.
view-source:https://api.nasa.gov/ (use Chrome here)
Yes here there Is not the HTML.
Ho about creating /eonet.html
from scratch and hard coding the copied HTML from the rendered page?
What is missing?
header
?footer
?CNAME
?Sorry but I'm from mobile so i don't know now How to inspect the page and right click on the HTML Element for copying It.
Then convert the accordion in the index.html
to an anchor (where Is this template?).
This redo doesn't hold any of the APIs themselves as stated in the README.
If you go to the page for NEO API (if not linked in api.nasa.gov a Google search should bring it up), you can try to find appropriate page / contacts for the near earth object API.
Originally posted by @JustinGOSSES in https://github.com/nasa/api-docs/issues/137#issuecomment-736223936