![Django Check SEO](https://user-images.githubusercontent.com/45763865/114545606-72178380-9c5c-11eb-99dd-1088bb2a0bd9.png)
*Replacing some features of Yoast or SEMrush for Django & Django-CMS users.*
In other words, django-check-seo will tell you if you have problems concerning a broad range of SEO aspects of your pages.
----
[![PyPI](https://img.shields.io/pypi/v/django-check-seo?color=%232a2)](https://pypi.org/project/django-check-seo/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/django-check-seo?color=%232a2)](https://pypi.org/project/django-check-seo/) [![GitHub last commit](https://img.shields.io/github/last-commit/kapt-labs/django-check-seo)](https://github.com/kapt-labs/django-check-seo)
----
# Install
*Only for django >= 2.2 & python >= 3.7, see [here](https://github.com/kapt-labs/django-check-seo/tree/python2) for a python2/django 1.8-1.11 version (tl;dr: install version <0.6).*
1. Install the module from [PyPI](https://pypi.org/project/django-check-seo/):
```
python3 -m pip install django-check-seo
```
2. Add it in your `INSTALLED_APPS`:
```
"django_check_seo",
```
3. Add this in your `urls.py` *(if you're using django-cms, put it before the `cms.urls` line or it will not work)*:
```
path("django-check-seo/", include("django_check_seo.urls")),
```
4. Update your Django [Site](https://i.imgur.com/pNRsKs7.png) object parameters with a working url (here's an [example](https://i.imgur.com/IedF3xE.png) for dev environment).
5. Add `testserver` (and maybe `www.testserver`) to your `ALLOWED_HOSTS` list in your settings.py (django-check-seo uses the Test Framework in order to get content, instead of doing an HTTP request).
6. ![**new in 1.0.0**](https://img.shields.io/badge/new_in-1.0.0-green) Add the permission (`use_django_check_seo`) to the users/groups you want to give access to.
7. *(optional) Configure the settings (see [config](#config)).*
8. ![that's all folks!](https://i.imgur.com/o2Tcd2E.png)
----
# Misc
This application needs `beautifulsoup4` (>=4.7.0) and `djangocms_page_meta` *(==0.8.5 if using django < 1.11)*. It may be used with or without `django-cms` (a django-check-seo button will appear in the topbar if you're using django-cms).
If you're not using Django CMS (only Django), here's the link format to access your pages reports:
```
https://example.com/django-check-seo/?page=/example-page/
-> will check https://example.com/example-page/
https://example.com/fr/django-check-seo/?page=/example-page/
-> will check https://example.com/example-page/
(using localized url (if you add django-check-seo in i18n_patterns))
```
----
# Config
## Basic settings
The basic config (used by default) is located in [`django-check-seo/conf/settings.py`](https://github.com/kapt-labs/django-check-seo/blob/master/django_check_seo/conf/settings.py#L5-L15) and looks like this:
```python
DJANGO_CHECK_SEO_SETTINGS = {
"content_words_number": [300, 600],
"internal_links": 1,
"external_links": 1,
"meta_title_length": [30, 60],
"meta_description_length": [50, 160],
"keywords_in_first_words": 50,
"max_link_depth": 3,
"max_url_length": 70,
}
```
If you need to change something, just define a dict named `DJANGO_CHECK_SEO_SETTINGS` in your settings.py.
### *Custom settings example:*
If you put this in your `settings.py` file:
```python
DJANGO_CHECK_SEO_SETTINGS = {
"internal_links": 25,
"meta_title_length": [15,30],
}
```
Then this will be the settings used by the application:
```python
DJANGO_CHECK_SEO_SETTINGS = {
"content_words_number": [300, 600],
"internal_links": 25, # 1 if using default settings
"external_links": 1,
"meta_title_length": [15,30], # [30, 60] if using default settings
"meta_description_length": [50, 160],
"keywords_in_first_words": 50,
"max_link_depth": 3,
"max_url_length": 70,
}
```
*Want to know more ? See the wiki page [Settings explained](https://github.com/kapt-labs/django-check-seo/wiki/Settings-explained).*
## Templates
The `django_check_seo/default.html` template have an `<aside>` block named `seo_aside` that you can replace if you want, using the `extends` & `{% block seo_aside %}` instructions, like this:
```jinja2
{% extends "django_check_seo/default.html" %}
{% block seo_aside %}
Hi!
{% endblock seo_aside %}
```
> This template will remplace all the `About`/`Documentation` & `Raw data` (content on the `<aside>` block) by "Hi!".
----
## Select main content (exclude header/footer/...)
Since django-check-seo will count things like number of words on the main content and the number of internal links, it is important to only select the *main* content of the page (an address in the footer is not the main content of your page).
Django-check-seo use a string (named `DJANGO_CHECK_SEO_EXCLUDE_CONTENT`) of [css selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to exclude unwanted html nodes from the html content:
```
DJANGO_CHECK_SEO_EXCLUDE_CONTENT = "tag, .class, #id, tag > .child_class"
```
*You can find a reference table of css selectors explained [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors#Reference_table_of_selectors) (on mdn docs).*
## *Example: See [this issue's comment](https://github.com/kapt-labs/django-check-seo/issues/35#issuecomment-593429870) for an example.*
----
# Want a screenshot?
![screenshot](https://i.imgur.com/hJGDvtw.png)
*Other (older) screenshots and videos are available on the [wiki](https://github.com/kapt-labs/django-check-seo/wiki/Medias).*
----
# Unit tests
They are located in `tests` folder.
The file `launch_tests.sh` is here to manage tests launching for you. You only need `python3-venv` (for python3 venv) and `virtualenv` (for **python2** venv) in order to make it work.
----
# Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
----
# Interested in finding out more?
Take a look at the [wiki](https://github.com/kapt-labs/django-check-seo/wiki/):
* [List & explanations of all checks](https://github.com/kapt-labs/django-check-seo/wiki/Description-of-the-checks)
* [How to add a check?](https://github.com/kapt-labs/django-check-seo/wiki/How-to-add-a-check%3F)
* ...
Raw data
{
"_id": null,
"home_page": "https://github.com/kapt-labs/django-check-seo",
"name": "django-check-seo",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Dev Kapt",
"author_email": "dev@kapt.mobi",
"download_url": "https://files.pythonhosted.org/packages/17/3a/a153ec8a1e3a537cde71c2393320ba8cced3e50745838f14d9fb8925aa5c/django_check_seo-1.0.1.tar.gz",
"platform": null,
"description": "![Django Check SEO](https://user-images.githubusercontent.com/45763865/114545606-72178380-9c5c-11eb-99dd-1088bb2a0bd9.png)\n\n*Replacing some features of Yoast or SEMrush for Django & Django-CMS users.*\n\nIn other words, django-check-seo will tell you if you have problems concerning a broad range of SEO aspects of your pages.\n\n----\n\n[![PyPI](https://img.shields.io/pypi/v/django-check-seo?color=%232a2)](https://pypi.org/project/django-check-seo/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/django-check-seo?color=%232a2)](https://pypi.org/project/django-check-seo/) [![GitHub last commit](https://img.shields.io/github/last-commit/kapt-labs/django-check-seo)](https://github.com/kapt-labs/django-check-seo)\n\n----\n\n# Install\n\n*Only for django >= 2.2 & python >= 3.7, see [here](https://github.com/kapt-labs/django-check-seo/tree/python2) for a python2/django 1.8-1.11 version (tl;dr: install version <0.6).*\n\n1. Install the module from [PyPI](https://pypi.org/project/django-check-seo/):\n ```\n python3 -m pip install django-check-seo\n ```\n\n2. Add it in your `INSTALLED_APPS`:\n ```\n \"django_check_seo\",\n ```\n\n3. Add this in your `urls.py` *(if you're using django-cms, put it before the `cms.urls` line or it will not work)*:\n ```\n path(\"django-check-seo/\", include(\"django_check_seo.urls\")),\n ```\n4. Update your Django [Site](https://i.imgur.com/pNRsKs7.png) object parameters with a working url (here's an [example](https://i.imgur.com/IedF3xE.png) for dev environment).\n\n5. Add `testserver` (and maybe `www.testserver`) to your `ALLOWED_HOSTS` list in your settings.py (django-check-seo uses the Test Framework in order to get content, instead of doing an HTTP request).\n\n6. ![**new in 1.0.0**](https://img.shields.io/badge/new_in-1.0.0-green) Add the permission (`use_django_check_seo`) to the users/groups you want to give access to.\n\n7. *(optional) Configure the settings (see [config](#config)).*\n\n8. ![that's all folks!](https://i.imgur.com/o2Tcd2E.png)\n\n----\n\n# Misc\n\nThis application needs `beautifulsoup4` (>=4.7.0) and `djangocms_page_meta` *(==0.8.5 if using django < 1.11)*. It may be used with or without `django-cms` (a django-check-seo button will appear in the topbar if you're using django-cms).\n\nIf you're not using Django CMS (only Django), here's the link format to access your pages reports:\n\n```\nhttps://example.com/django-check-seo/?page=/example-page/\n -> will check https://example.com/example-page/\n\nhttps://example.com/fr/django-check-seo/?page=/example-page/\n -> will check https://example.com/example-page/\n (using localized url (if you add django-check-seo in i18n_patterns))\n```\n\n----\n\n# Config\n\n## Basic settings\n\nThe basic config (used by default) is located in [`django-check-seo/conf/settings.py`](https://github.com/kapt-labs/django-check-seo/blob/master/django_check_seo/conf/settings.py#L5-L15) and looks like this:\n```python\nDJANGO_CHECK_SEO_SETTINGS = {\n \"content_words_number\": [300, 600],\n \"internal_links\": 1,\n \"external_links\": 1,\n \"meta_title_length\": [30, 60],\n \"meta_description_length\": [50, 160],\n \"keywords_in_first_words\": 50,\n \"max_link_depth\": 3,\n \"max_url_length\": 70,\n}\n```\n\nIf you need to change something, just define a dict named `DJANGO_CHECK_SEO_SETTINGS` in your settings.py.\n\n### *Custom settings example:*\n\nIf you put this in your `settings.py` file:\n\n```python\nDJANGO_CHECK_SEO_SETTINGS = {\n \"internal_links\": 25,\n \"meta_title_length\": [15,30],\n}\n```\n\nThen this will be the settings used by the application:\n\n```python\nDJANGO_CHECK_SEO_SETTINGS = {\n \"content_words_number\": [300, 600],\n \"internal_links\": 25, # 1 if using default settings\n \"external_links\": 1,\n \"meta_title_length\": [15,30], # [30, 60] if using default settings\n \"meta_description_length\": [50, 160],\n \"keywords_in_first_words\": 50,\n \"max_link_depth\": 3,\n \"max_url_length\": 70,\n}\n```\n\n*Want to know more ? See the wiki page [Settings explained](https://github.com/kapt-labs/django-check-seo/wiki/Settings-explained).*\n\n## Templates\n\nThe `django_check_seo/default.html` template have an `<aside>` block named `seo_aside` that you can replace if you want, using the `extends` & `{% block seo_aside %}` instructions, like this:\n\n```jinja2\n{% extends \"django_check_seo/default.html\" %}\n\n{% block seo_aside %}\n Hi!\n{% endblock seo_aside %}\n```\n> This template will remplace all the `About`/`Documentation` & `Raw data` (content on the `<aside>` block) by \"Hi!\".\n\n----\n\n## Select main content (exclude header/footer/...)\n\nSince django-check-seo will count things like number of words on the main content and the number of internal links, it is important to only select the *main* content of the page (an address in the footer is not the main content of your page).\n\nDjango-check-seo use a string (named `DJANGO_CHECK_SEO_EXCLUDE_CONTENT`) of [css selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to exclude unwanted html nodes from the html content:\n\n```\nDJANGO_CHECK_SEO_EXCLUDE_CONTENT = \"tag, .class, #id, tag > .child_class\"\n```\n\n*You can find a reference table of css selectors explained [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors#Reference_table_of_selectors) (on mdn docs).*\n\n## *Example: See [this issue's comment](https://github.com/kapt-labs/django-check-seo/issues/35#issuecomment-593429870) for an example.*\n\n----\n\n# Want a screenshot?\n\n![screenshot](https://i.imgur.com/hJGDvtw.png)\n\n*Other (older) screenshots and videos are available on the [wiki](https://github.com/kapt-labs/django-check-seo/wiki/Medias).*\n\n----\n\n# Unit tests\n\nThey are located in `tests` folder.\n\nThe file `launch_tests.sh` is here to manage tests launching for you. You only need `python3-venv` (for python3 venv) and `virtualenv` (for **python2** venv) in order to make it work.\n\n----\n\n# Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n----\n\n# Interested in finding out more?\n\nTake a look at the [wiki](https://github.com/kapt-labs/django-check-seo/wiki/):\n\n * [List & explanations of all checks](https://github.com/kapt-labs/django-check-seo/wiki/Description-of-the-checks)\n * [How to add a check?](https://github.com/kapt-labs/django-check-seo/wiki/How-to-add-a-check%3F)\n * ...\n",
"bugtrack_url": null,
"license": null,
"summary": "Django Check SEO will check the SEO aspects of your site for you, and will provide advice in case of problems.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/kapt-labs/django-check-seo"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9f7644bf7fe09bb70f11f2d70a17d11919703c9f674c710b968a47ed9209353c",
"md5": "46f458f1a543b4b50232b1e9a1704a04",
"sha256": "ebe8a28469024eb2a4f5a6373a88b083794f7e4d88c4e14cbec21ec300671622"
},
"downloads": -1,
"filename": "django_check_seo-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "46f458f1a543b4b50232b1e9a1704a04",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 583754,
"upload_time": "2024-05-02T11:15:03",
"upload_time_iso_8601": "2024-05-02T11:15:03.785350Z",
"url": "https://files.pythonhosted.org/packages/9f/76/44bf7fe09bb70f11f2d70a17d11919703c9f674c710b968a47ed9209353c/django_check_seo-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "173aa153ec8a1e3a537cde71c2393320ba8cced3e50745838f14d9fb8925aa5c",
"md5": "78a4f9c2d1e598e4682158c0ef00de4a",
"sha256": "639ae7cd13631730b8e28b169d398d59e2bb441f4717c4aa0f5636186474b518"
},
"downloads": -1,
"filename": "django_check_seo-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "78a4f9c2d1e598e4682158c0ef00de4a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 594674,
"upload_time": "2024-05-02T11:15:07",
"upload_time_iso_8601": "2024-05-02T11:15:07.175185Z",
"url": "https://files.pythonhosted.org/packages/17/3a/a153ec8a1e3a537cde71c2393320ba8cced3e50745838f14d9fb8925aa5c/django_check_seo-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-02 11:15:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kapt-labs",
"github_project": "django-check-seo",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"lcname": "django-check-seo"
}