From 2014a4f024631a8210f90c1859642bf45485273e Mon Sep 17 00:00:00 2001 From: Daniel Bauer Date: Fri, 1 Nov 2024 13:09:19 +0100 Subject: [PATCH] update readme --- README.md | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index ca94981..c316e94 100644 --- a/README.md +++ b/README.md @@ -40,37 +40,18 @@ Here's how you can use it: ```python from django.http import HttpResponse from django_signposting.utils import add_signposts +from signposting import Signpost, LinkRel def my_view(request): response = HttpResponse("Hello, world!") # Add signpostings as string - add_signposts(response, - type="https://schema.org/Dataset", - author="https://orcid.org/0000-0001-9447-460X") - - return response -``` - -Multiple links with the same link type can be added as lists and the content type of a link -can be defined by using tuples: - -```python - -from django.http import HttpResponse -from django_signposting.util import add_signposts - -def my_view(request): - response = HttpResponse("Hello, world!") - - # Add signpostings as string - add_signposts(response, - type="https://schema.org/Dataset", - author="https://orcid.org/0000-0001-9447-460X", - item=[ - ("https://example.com/image.png", "image/png"), - ("https://example.com/download.zip", "application/zip") - ]) + add_signposts( + response, + Signpost(LinkRel.type, "https://schema.org/Dataset"), + Signpost(LinkRel.author, "https://orcid.org/0000-0001-9447-460X") + Signpost(LinkRel.item, "https://example.com/download.zip", "application/zip") + ) return response ``` @@ -83,7 +64,7 @@ HTTP/2 200 ... link: ; rel="type" , ; rel="author" , - ; rel="item" ; type="application/json+ld" + ; rel="item" ; type="application/zip" ``` ## License