Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ repos:
rev: 3.1.8
hooks:
- id: setuptools-odoo-make-default
additional_dependencies: ["setuptools<82"]
- id: setuptools-odoo-get-requirements
additional_dependencies: ["setuptools<82"]
args:
- --output
- requirements.txt
Expand Down
1 change: 1 addition & 0 deletions setup/website_noindex/odoo/addons/website_noindex
6 changes: 6 additions & 0 deletions setup/website_noindex/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
23 changes: 23 additions & 0 deletions website_noindex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Website_noindex

## Description

Add the possibility to deactivate website indexation by the search engines like Google
and Bing.

You can activate/deactivate the website indexation by de Website Admin module /
Configuration. Status of indexation for website will appear in top right navbar (if not
indexed there will be a warning info)

## Technical

This module add the "no_index" field on the website module.

## Installation

Download and copy the directory of this module on your odoo-addons directory and install
it. No special requirements are required.

### By git

git clone --depth=1 https://github.com/kardec-web/odoo-website-addons.git
1 change: 1 addition & 0 deletions website_noindex/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
37 changes: 37 additions & 0 deletions website_noindex/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##############################################################################
#
# Kardec
# Copyright (C) 2016-Today Kardec (<http://www.kardec.net>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Website - no index, no follow",
"version": "14.0.1.0.0",
"category": "Website",
"summary": "Deactivate option for website indexing by search engines",
"license": "AGPL-3",
"author": "Kardec, Therp B.V., Odoo Community Association (OCA)",
"website": "https://github.com/OCA/website",
"depends": ["website"],
"data": [
"views/res_config_settings.xml",
"views/assets.xml",
"views/website_layout.xml",
"views/website_navbar.xml",
],
"installable": True,
"application": False,
}
1 change: 1 addition & 0 deletions website_noindex/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import website
21 changes: 21 additions & 0 deletions website_noindex/models/website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from odoo import fields, models


class Website(models.Model):
_inherit = "website"

no_index = fields.Boolean(
string="Do not index website",
help="Disallow the site to appear in search engines like Google and Bing.",
)


class WebsiteConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

no_index = fields.Boolean(
related="website_id.no_index",
readonly=False,
string="Do not index website",
help="Disallow the site to appear in search engines like Google and Bing.",
)
6 changes: 6 additions & 0 deletions website_noindex/static/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.no-index .fa {
color: #a94442 !important;
}
.no-index.no-index-hidden {
display: none;
}
Binary file added website_noindex/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions website_noindex/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="color:#A24689;">Website no index</h2>
<h3 class="oe_slogan">Add the possibility to deactivate website indexation by the search engines like Google and Bing.</h3>
<div class="oe_demo oe_picture oe_screenshot">
<img src="odoo-website-addons-noindex.gif">
</div>
</div>
</section>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions website_noindex/views/assets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="assets_frontend_inherited" inherit_id="website.assets_frontend">
<xpath expr="//link[last()]" position="after">
<link
rel="stylesheet"
type="text/css"
href="/website_noindex/static/css/styles.css"
/>
</xpath>
</template>
</odoo>
28 changes: 28 additions & 0 deletions website_noindex/views/res_config_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="view_website_config_settings" model="ir.ui.view">
<field name="name">res.config.settings.website.noindex</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form" />
<field name="arch" type="xml">
<div id="seo_settings" position="inside">
<div
class="col-12 col-lg-offset-6 col-lg-6 o_setting_box"
id="no_index_settings"
>
<div class="o_setting_left_pane">
<field name="no_index" />
</div>
<div class="o_setting_right_pane">
<label for="no_index" />
<div class="text-muted">
Do not index Website
</div>
</div>
</div>
</div>
</field>
</record>
</data>
</odoo>
11 changes: 11 additions & 0 deletions website_noindex/views/website_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<odoo>
<template id="noindex_nofollow" inherit_id="website.layout">
<xpath expr="//meta[@name='viewport']" position="before">
<meta
t-if="website and website.no_index"
name="robots"
content="noindex, nofollow"
/>
</xpath>
</template>
</odoo>
23 changes: 23 additions & 0 deletions website_noindex/views/website_navbar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="noindex_navbar"
inherit_id="website.user_navbar"
name="Website noindex, nofollow navbar"
>
<xpath expr="//ul[contains(@class, 'o_menu_systray')]" position="inside">
<li
t-att-class="'no-index %s' % 'no-index-hidden' if not website.no_index else 'no-index'"
groups="base.group_user"
>
<a
data-toggle="tooltip"
data-placement="bottom"
title="The site is disallowed to appear in search engines like Google and Bing"
>
<i class="fa fa-warning" />
&#160;Website no indexed</a>
</li>
</xpath>
</template>
</odoo>
Loading