Skip to main content

Highlight the keywords of a page if a visitor is coming form a search engine.

Project description

Latest version on Pypi Downloads from Pypi

Build Status - develop branch Coverage of the code

Django Search Engine Keywords Highlighter,

is a middleware for Django providing the capacities to highlight the user’s search keywords if he is coming from a search engine like Google, Yahoo or a custom search form plugged in your Website.

It retrieves the keywords of the search and decorate them with a span markup containing the classes highlight term-X for CSS makuping.

Installation

First of all you need to install BeautifulSoup >= 4.0.

Then install the package in your PYTHON_PATH by getting the sources and run setup.py or use pip.

$ pip install -e git://github.com/Fantomas42/django-sekh.git#egg=django-sekh

Usage

In your settings file, simply add this middleware at the end of the list.

MIDDLEWARE_CLASSES = (
  ...
  'sekh.middleware.KeywordsHighlightingMiddleware',
  )

This is it !

Search Engines

Currenty django-sekh supports these search engines :

  • Ask

  • Baidu

  • Bing

  • Google

  • Hotbot

  • Lycos

  • Yahoo

And even if you have a custom search engine plugged on your website, sekh can highlight the searched keywords. Currently sekh will highlight all the terms contained in this list of GET variables :

['highlight', 'hl', 'q', 'query', 'pattern']

You can change the supported values by defining a variable named HIGHLIGHT_GET_VARNAMES representing a list of supported variable names in your project’s settings.

Testing

If you want to test the highlighter, you can pass keywords in the hl parameter in GET.

http://localhost:8000/admin?hl=django%20admin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-sekh-0.4.tar.gz (13.5 kB view details)

Uploaded Source

File details

Details for the file django-sekh-0.4.tar.gz.

File metadata

  • Download URL: django-sekh-0.4.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-sekh-0.4.tar.gz
Algorithm Hash digest
SHA256 0461d04da440cc539ffc1cc4fb23ab805b706040dd97a784d1bb9dcb2570ae17
MD5 eff619243753391cc29473261167c184
BLAKE2b-256 5d6374816e1d995398ceaf60a33270d51b9bedb73aa69b8fec56844adf342854

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page