This is zotero.org's Web Library capable of being installed/run on other websites.
Web Library is a single-page application implemented in Javascript. It uses Zotero API via CORS requests and requires keys configured in order to access private libraries.
- Clone git repository into target web directory (
git clone --recursive https://github.com/zotero/web-library.git
) - Ensure up-to-date version of Node is used. It should be possible to build Web Library with any recent version of Node, see
.nvmrc
for recommended version of Node (usually current LTS). On systems where nvm is available it's possible to usenvm install
andnvm use
to install and switch to a preferred version of node. - Run
npm install
to install dependencies - Tweak configuration in
src/html/index.html
and/orsrc/html/embedded.html
. Default configuration displays a public library in read-only mode. In order to edit a library, changeuserId
and provideapiKey
. - Run development proces:
npm start
- Point browser at
http://localhost:8001/
to see the demo - Modyfing source files will trigger incremental build
Production-ready version can be built with npm run build
and served with npm run serve
.
Web Library reads configuration from a DOM node with ID zotero-web-library-config
. See example config in src/html/index.html
. To access private libraries, userId
and apiKey
must be provided. It's also possible to configure Web Library to only display public libraries, in which case libraries
object must be populated and it must include value for defaultLibraryKey
as well as includeMyLibrary
set to false
.
There are two build targets controlled by TARGET
environment variable: zotero
and embedded
. Former produces a single-page app as seen on zotero.org, latter produces a web-library widget that can be embedded on other pages. Embedded build is currently considered experimental. It's also possible to build both variants using TARGET
set to all
(default behaviour).
The following environment variables are recognized:
DEBUG
- if set to1
extra info about produced bundle will be printed to the console. Increases build time.EMBEDDED
- if set to1
dev server will default tosrc/html/embedded.html
, otherwise it will servesrc/html/index.html
.LOCALE_CACHE_TIME
- advanced usage, seescripts/fetch-locale.cjs
.NODE_ENV
- used by build scripts to control various debug options. Seepackage.json
.PORT
- port on which development server listens for incoming connections.STYLES_CACHE_TIME
- advanced usage, seescripts/build-styles-json.cjs
.TARGET
- see Build targets above.TRANSLATE_URL
- URL where to proxy translation requests.USE_HTTPS
- if set to1
dev server will use HTTPS. Requires certificates, seescripts/server.cjs
.