Commit 76d813aa authored by tobinski's avatar tobinski
Browse files

Update readme

parent a0f0fe9a
# Histhub-net widget
The histhub-net widget can display sameas resources from histhub linking services. You can integrate it into your site and display links to other providers.
The histhub-net widget can display resources from [histhub linking services](https://histhub.ch/tag/geolinker/). You can integrate it into your site and enrich your content with links to other projects.
__The widget and the apis are in beta status. They may change in the future.__
## Partner
To use the webcomponent and the apiservice you should to be a partner of histhub. If you are interested, please send us a mail.
__The widget and the api's are in beta status. They may change in the future.__
## Webcomponent
The widget itself is a [webcomponent](https://en.wikipedia.org/wiki/Web_Components). It integrates smoothly into an existing website. You just need to add some markup and load a javascript file.
## Integration
Just have a look at the example folder. There you can find a set of working examples.
Just have a look at the [example folder](examlpe/index.html). There you can find a set of working examples.
```html
<html>
<head>
......@@ -15,13 +20,13 @@ Just have a look at the example folder. There you can find a set of working exam
</html>
```
```html
<!-- add the component wehre you like to display the links -->
<!-- add the component where you like to display the links -->
<histhub-widget endpoint="ENDPOINT" resolver="RESOLVER" location="URL TO LOOK FOR"></histhub-widget>
```
## API
### Endpoint
The endpoint defines the restapi, where the widget makes the call to get the links. Currently we provide three endpoints for different resource types.
The endpoint defines the rest-api, where the widget fetches the links. Currently we provide three endpoints for different resource types.
* Tagcloud https://api.tagcloud.histhub.ch/v1/sameas/
* Geolinker https://api.geolinker.histhub.ch/v1/sameas/
* Geolinker https://api.geolinker.histhub.ch/v1/similarto/
......@@ -31,7 +36,7 @@ The endpoint defines the restapi, where the widget makes the call to get the lin
Choose one of the endpoint to get links for your resource
### Resolver
The endpoint uses different technologies to generate the links. Those technologies calls resolver. You need to define a resolver to get the links for your preferences.
The endpoint uses different technologies to generate the links. Those technologies called resolver. You need to define a resolver to get the links for your preferences.
__Tagcloud and Orgalinker__
......@@ -39,32 +44,32 @@ For those two services we provide the `resolvermanual` . The links provided by t
__Geolinker__
The geolinker provides for the `sameas` endpoint the `resolverneo4j` resolver. The links provided by this resolver are done semi-automatically. See example 3
The geolinker provides for the [sameas](https://source.dodis.ch/histhub/resolver-neo4j) endpoint the [resolverneo4j](https://source.dodis.ch/histhub/resolver-elasticsearch) resolver. The links provided by this resolver are done semi-automatically. See example 3
For the `similarto` endpoint the geolinker provides a `elasticsearchresolver`. The data are guessed based on a matching algorithm. See example 4
### Location
The location is an optional parameter. By default the widget uses the current window.location.href to make the request. You can specify the url to look for over the url parameter
The location is an optional parameter. By default the widget uses the current `window.location.href` to make the request. You can specify the location url over the url parameter
### Template
The `tempate` is an optional parameter. You can provide your own template to modify the structure and styles of the widget.
### language (beta)
The `language` parameter is optional (default=de) and let you define the language of the provider. We resolve the name of the provider over the url pattern. Possible languages are `de`, `fr`, `it` and `en`.
The `language` parameter is optional (default=de) and let you define the language of the provider. We resolve the name of the provider over the [url pattern](https://source.dodis.ch/histhub/url-resolver). Possible languages are `de`, `fr`, `it` and `en`.
### Timeout
The architecture of the `geolinker` waits for a certain timeout (default=2000) for the microservices to find an answer to the query. You can define that timeout. If you often get 404 try to set a higher timeout
The architecture of the `geolinker` waits for a certain timeout (default=2000) to find an answer to the query. If you often get 404, try to set a higher timeout.
### Link-target
By default the target of a link is `_blank`. If you wish to change this you can configure the zarget over the `link-target` attribute.
By default the target of a link is `_blank`. If you wish to change this you can configure the target over the `link-target` attribute.
## Styling
The webcomponent uses a shadow dom and encapsulate the styles. So it will not use your sites default css styles but also not change any other styles in your site. There are two option to override the component default styles
The webcomponent uses a [shadow dom](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM) and encapsulate the styles. So it will not use your sites default css styles will not interfere with any other styles in your site. There are two option to override the component default styles
### Slots
Slots provides the possibility to override some part of the webcomponent. The histhub-widget provides a `title` and a `defaut` slot.
#### Heading (slot)
You can change the Heading of the widget with the `title` slot. This slot will override the default title. In almost all examples we use this slot to change the title. If you override a slot your site css rules applies for this element. Example #6 changes the color of the heading
#### Credits
You can change the `credits` in the corresponding slot. Please make sure you mention our work. In the example
#### Default Slot
If you want to display some additional text beneath the links you can use the default slot. Just put the content inside the histhub-widget element. Example #7 adds additional information under the links
[Slots](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots) provide the possibility to override some part of the webcomponent. The histhub-widget provides a `title`, a `credits` and a `defaut` slot.
#### Title (slot)
You can change the title of the widget with the `title` slot. This slot will override the default title. In almost all examples we use this slot to change the title. If you override a slot your site css rules applies for this element. Example #6 changes the color of the heading
#### Credits (slot)
You can change the `credits` in the corresponding slot. Please make sure you mention our work. In the example #10 we changed this slot.
#### Default (slot)
If you want to display some additional text beneath the links you can use the default slot. Just put the content inside the histhub-widget element. Example #7 adds additional information under the links.
### Css Variables
To change basic visual aspects of the component you can define css variables and override default settings. You have the following options to change the styles of the [shadow dom](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM).
To change basic visual aspects of the component you can define [css variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) and override default settings. You have the following options to change the styles of the [shadow dom](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM).
```css
:root {
--histhub-h3-maring: 0 0 0 0.5rem;
......@@ -89,4 +94,9 @@ To change basic visual aspects of the component you can define css variables and
### Provide a template
You can provide your own template with your own styles. This will give you the power to modify every visual aspect of the webcomponent. You can define your own styles for the shadowdom and add or remove html elements. The example #8 uses a custom template.
## Compatibility
This is a modern approach to build custom web-elements. Not all browsers support this yet.
* Css-cars are supported in modern browsers only (ie-edge > 15)
* Webcomponent are supported only in modern browsers (id-edge > 18, FF > 62)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment