Handle opensearch.xml for search engine registratin in browsers.
Project description
OpenSearch application for django
This application provide a way to integrate the OpenSearch XML file to a django application.
[[TOC]]
Installation
Install the package pip install django-opensearch-xml
Configuration
- Add "opensearch_xml" to settings.INSTALLED_APPS.
INSTALLED_APPS = [ ..., "opensearch_xml", ... ]
- Add "opensearch_xml" to URLS
from django.urls import path, include urlpatterns = [ ..., path("opensearch/", include("opensearch_xml.urls")), ... ]
In the base template add the template tag that renders the search link
{% load opensearch_xml %}
<!DOCTYPE html>
<html lang="en" class="no-js" {{ html_attr|safe }}>
<head>
..
{% opensearch_xml %}
</head>
<body>
...
</body>
</html>
Settings
Add OPENSEARCH_XML_<params> to the application settings
OPENSEARCH_XML_CONTACT_EMAIL = ""
: Email address of the maintainer the application
OPENSEARCH_XML_SHORT_NAME = ""
: Brief human-readable name of the search engine
OPENSEARCH_XML_DESCRIPTION = ""
: Human-readable description of the search engine and its contents - REQUIRED
OPENSEARCH_XML_FAVICON_WIDTH = 16
: Width of the favicon
OPENSEARCH_XML_FAVICON_HEIGHT = 16
: Height of the favicon
OPENSEARCH_XML_FAVICON_TYPE = "image/x-icon"
: Type of the icon
OPENSEARCH_XML_FAVICON_FILE = ""
: File on the favicon, relative to the path referenced in STATIC_PATH
OPENSEARCH_XML_SEARCH_URL = "search"
: Django URL name of the search. This URL will be passed to the reverse() function
OPENSEARCH_XML_SEARCH_QUERYSTRING = "q="
: Querystring used to prepend the search parameters
OPENSEARCH_XML_INPUT_ENCODING = "UTF-8"
: Encoding for the querystring
Usage
Add the template tag {% opensearch_xml_meta %} into the page <head>.
{% load opensearch_xml_tags %}
<html lang="en">
<head>
<title>My title</title>
...
{% opensearch_xml_meta %}
</head>
<body>
...
</body>
</html>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_opensearch_xml-0.4.0.tar.gz.
File metadata
- Download URL: django_opensearch_xml-0.4.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9182dc621aa76d7267edbb803436af48f4299e9a4075c886fb02792a11a3666
|
|
| MD5 |
a946b4a2a5bf07bfd76a288f39440a86
|
|
| BLAKE2b-256 |
5d8ffdad5a7a69af28979556624b32b4fbfee8616b46b38498f04853ec8d0a7e
|
File details
Details for the file django_opensearch_xml-0.4.0-py3-none-any.whl.
File metadata
- Download URL: django_opensearch_xml-0.4.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a26e68daddbc9e4f6c3de77bee50b47a465a3f56dccea84938ea4209f7b43fdb
|
|
| MD5 |
c74a7f6ef542d35d1ed5474c7e2c9f13
|
|
| BLAKE2b-256 |
7325826fcb64a6b84f750474eb16be646149157278e3c692a5115a5a32ed48d6
|