2019-10-27 01:39:52 +01:00
.. _ui-customizations:
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
UI Overview and Customization
=============================
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
pywb includes a number of options for styling the UI, including completely replacing the UI with a custom version.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
Customizing UI Templates
------------------------
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
pywb renders HTML using the Jinja2 templating engine, loading default templates from the `` pywb/templates `` directory.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
If running from a custom directory, templates can be placed in the `` templates `` directory and will override the defaults.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
See :ref: `template-guide` for more details on customizing the templates.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
New Vue-based UI (Alpha)
------------------------
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
With pywb 2.7.0, pywb includes a brand new UI which includes a visual calendar mode and a histogram-based banner.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
See :ref: `new-vue-ui` for more information on how to enable this UI.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
Changing the Default Styles
---------------------------
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
When using the default UI, pywb styles can be configured in `` pywb/static/default_banner.css ``
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
The stylesheet contained under `` #_wb_frame_top_banner `` affect the rendering of the default banner in framed mode.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
Configuring a Logo
------------------
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
An optional logo can be configured at the top-left of the default banner.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
To enable the logo set the `` ui.logo `` property in `` config.yaml `` to point to the URL of the logo.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
The URL can be any image URL, including a URL served from static directory.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
For example, to add the default pywb logo to the banner, use the following to the config:
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
.. code :: yaml
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
ui:
logo: /static/pywb-logo-sm.png
2019-09-05 18:13:12 -04:00
2019-10-27 01:39:52 +01:00
Static Files
2021-12-13 22:54:29 -08:00
------------
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
pywb will automatically support static files placed under the following directories:
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
* Files under the root `` static `` directory: `` static/my-file.js `` can be accessed via `` http://localhost:8080/static/my-file.js ``
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
* Files under the per-collection directory: `` ./collections/my-coll/static/my-file.js `` can be accessed via `` http://localhost:8080/pywb/static/_/my-coll/my-file.js ``
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
It is possible to change these settings via `` config.yaml `` :
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
* `` static_prefix `` - sets the URL path used in pywb to serve static content (default `` static `` )
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
* `` static_dir `` - sets the directory name used to read static files (default `` static `` )
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
While pywb can serve static files, it is recommended to use an existing web server to serve static files, especially if already using it in production.
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
For example, this can be done via nginx with:
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
.. code :: text
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
location /wayback/static {
alias /pywb/pywb/static;
}
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
Loading Custom Metadata
-----------------------
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
pywb includes a default mechanism for loading externally defined metadata, loaded from a per-collection `` metadata.yaml `` YAML file at runtime.
2019-10-27 01:39:52 +01:00
2021-12-13 22:54:29 -08:00
See :ref: `custom-metadata` for more details.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
Additionally, the banner template has access to the contents of the `` config.yaml `` via the `` {{ config }} `` template variable,
allowing for passing in arbitrary config information.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
For more dynamic loading of data, the banner and all of the templates can load additional data via JS `` fetch() `` calls.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
Embedding pywb in frames
------------------------
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
It should be possible to embed pywb replay itself as an iframe as needed.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
For customizing the top-level page and banner, see :ref: `custom-top-frame` .
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
However, there may be other reasons to embed pywb in an iframe.
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
This can be doen simply by including something like:
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
.. code :: html
2019-09-05 18:13:12 -04:00
2021-12-13 22:54:29 -08:00
<html>
<head>
<body>
<div>Embedding pywb replay</div>
<iframe style="width: 100%; height: 100%" src="http://localhost:8080/pywb/20130729195151/http://test@example.com/"></iframe>
</body>
</html>
2019-09-05 18:13:12 -04:00