- Notifications
You must be signed in to change notification settings - Fork0
theoromeo/NextPage-Client
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The NextPage Client provides an interface for users to interact with NextPage-enabled pages.
To learn more about defining NextPage pages, visitThe NextPage Docs.
This document explains how to install the client and query NextPage-enabled pages.
To install the client on your webpage, add the minified file located in./build
to the<head>
section of your HTML document.
<head> ...<scriptsrc="./path/to/nextpage.min.js"></script></head>
That's it—no configuration is needed. The client will handle everything for you.
To query a node you will need to add the url of a NextPage-enabled webpage appended with":"
and thenode name
as follows
<ahref="https://example.com/info/about-the-information:primary">Visit the page...</a>
The NextPage-Client intercepts allhref/a (anchor)
interactions where theURL path string contains ":".
URLs containing
":"
are invalid in standard urls, making it a great choice to use as an operator for querying.
The NextPage-Client will then fetch the NextPage-enabled webpage and attempt to retrieve the node named"primary"
and will parse and display the node through its interface.
To run the examples, you will need to set up a local hostname. In thevite.config.js
, this is set tolocalhost.local
. NextPage-Parser validates a URL before fetching the webpage and does not recognize IP based addresses as valid urls.
For guidance on setting up a hostname:
Use the following information:
- IP Address:
127.0.0.1
- Domain:
localhost.local
After setting up your local hostname, run the following command:
npm run dev
Then, navigate tohttp://localhost.local/examples/index.html
. You can click on the links to see how different view types are displayed and how they are defined in various HTML files.
Simply use the Vite commands to build the client. The output will be in the./build
directory.
This will bundle and minify the client script along with the HTML templates that define the UI (found in ./src/template).
# Build the clientvite build# Start development servervite dev