GithubHelp home page GithubHelp logo

kagiso_smart_404's Introduction

Codeship Status for Kagiso-Future-Media/kagiso_smart_404 codecov.io

kagiso_smart_404

Recommend similar pages if a given page is not found.

If a page is not found, looks up the pages in the database and returns any page with a similarly spelt slug, using trigrams for matching

Installation

pip install kagiso_smart_404

Add kagiso_smart_404 to your INSTALLED_APPS in your settings.py.

python manage.py migrate

Add the following to urls.py: handler404 = 'kagiso_smart_404.views.not_found

Sample 404 Page

{% extends "core/base.html" %}
{% load staticfiles %}
{% load wagtailcore_tags %}
{% load core_tags %}

{% block title %}404 error{% endblock %}

{% block body_class %}template-404{% endblock %}

{% block content %}
  <section class="error-page-wrapper error-404">
    <div class="error-message-block">
      <h1 class="error-title">404 Error</h1>
      <h4 class="error-subtitle">frequency not found</h4>
      {% if suggested_page %}
      <p>Were you looking for
        <a style="color: white; text-decoration: underline" href="{{ suggested_page.tracking_url }}">
          {{ suggested_page.title }}?
        </a>
      </p>
      {% else %}
        <p>The page you were looking for could not be found.</p>
      {% endif %}
    </div>
  </section>

{% endblock %}

Metrics Tracking via Librato

Add the following to your settings.py's MIDDLEWARE_CLASSES:

'kagiso_smart_404.middleware.SmartRedirectMetricsMiddleware',

Running the tests

py.test

kagiso_smart_404's People

Contributors

lee-kagiso avatar michaelvorster avatar colinfrankb avatar

Watchers

Frits Stegmann avatar James Cloos avatar Wayne avatar Richard Kuiper avatar  avatar  avatar

Forkers

leebrooks0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.