页面

Odoo 允许您创建网站页面,并根据您的需求自定义其内容和外观。

Static pages have stable content, such as the homepage. You can manually create new ones, define their URLs, adapt their properties, etc. Dynamic pages, on the other hand, are generated dynamically. All pages generated automatically by Odoo, for example, when you install an app or module (e.g., /shop or /blog) or publish a new product or blog post, are dynamic pages and are therefore managed differently.

页面创建

Website pages can be created from the frontend and the backend. To create a new website page, proceed as follows:

    • Either open the Website app, click + New in the top-right corner, then select Page;

    • Or go to Website ‣ Site ‣ Pages and click New.

  1. Enter a Page Title; this title is used in the menu and the page’s URL.

  2. Click Create.

  3. Customize the page’s content and appearance using the website builder, then click Save.

  4. Publish the page.

注解

Disable Add to menu if the page should not appear in the menu.

页面管理

发布/取消发布页面

Pages need to be published to make them accessible to website visitors. To publish or unpublish a page, access it and toggle the switch in the upper-right corner from Unpublished to Published, or vice versa.

未发布/已发布切换

注解

也可以:

  • publish/unpublish a page from the page properties, where you can define a publishing date and/or restrict the page’s visibility if needed;

  • publish/unpublish several pages at once: go to Website ‣ Site ‣ Pages, select the pages, then click Action and select Publish or Unpublish.

主页

When you create a website, Odoo creates a dedicated Home page by default, but you can define any website page as your homepage. To do so, go to Website ‣ Configuration ‣ Settings, then, in the Website info section, define the URL of the desired page in the field Homepage URL (e.g., /shop).

Alternatively, you can define any static page as your homepage by going to Website ‣ Site ‣ Properties. Select the Publish tab and enable Use as Homepage.

页面属性

To modify a static page’s properties, access the page you wish to modify, then go to Site ‣ Properties.

The Name tab allows you to:

  • 使用 页面名称 字段重命名页面;

  • 修改 页面 URL。在这种情况下,如果需要,您可以将旧的 URL 重定向到新的 URL。要这样做,请启用 重定向旧 URL,然后选择 类型重定向:

    • 301 永久重定向: 永久重定向页面;

    • 302 临时移动: 临时重定向页面。

    重定向旧的URL

您可以在 发布 选项卡中进一步调整页面的属性:

  • 在顶部菜单中显示:如果您不希望页面显示在菜单中,请禁用;

  • 设为首页:如果您希望该页面成为您的网站首页,请启用;

  • Indexed: Disable if you don’t want the page to be shown in search engine results;

  • Published: Enable to publish the page;

  • 发布日期: 要在特定时间发布页面,请选择日期,点击时钟图标设置时间,然后点击绿色勾号确认您的选择。

  • 可见性:选择谁可以访问页面:

    • 全部

    • Signed In

    • Restricted Group: Select the user access group(s) in the Authorized group field.

    • With Password: Enter the password in the Password field.

小技巧

Some of these properties can also be modified from Website ‣ Site ‣ Pages.

复制页面

要复制页面,请访问页面,然后转到 站点 ‣ 属性,然后点击 复制页面。输入 页面名称,然后点击 确定。默认情况下,新页面将添加在菜单中复制的页面之后,但您可以从菜单中删除它或使用 菜单编辑器 更改其位置。

删除页面

要删除页面,请按照以下步骤进行:

  1. 访问页面,然后转到 站点 ‣ 属性 并点击 删除页面

  2. 屏幕上弹出一个窗口,其中包含所有链接,这些链接指向您要删除的页面,按类别组织。为了确保网站访问者不会进入404错误页面,您必须更新指向该页面的网站上的所有链接。为此,展开一个类别,然后单击一个链接以在新窗口中打开它。或者,您可以为已删除的页面设置一个 重定向

  3. 一旦您更新了链接(或设置了 重定向),选择 我确定 复选框,然后点击 确定

URL redirect mapping

URL redirect mapping consists in sending visitors and search engines to a URL different from the one they initially requested. This technique is used, for example, to prevent broken links when you delete a page, modify its URL, or migrate your site from another platform to an Odoo domain. It can also be used to improve 搜索引擎优化(SEO).

To access existing URL redirections and create new ones, activate the developer mode and go to Website ‣ Configuration ‣ Redirects.

注解

To create a new redirection, click the New button, then fill in the fields:

  • Name: Enter a name to identify the redirect.

  • Action: Select the type of redirection:

    • 404 Not found: visitors are redirected to a 404 error page when they try to access an unpublished or deleted page.

    • 301 Moved Permanently: for permanent redirections of unpublished or deleted static pages. The new URL is shown in search engine results, and the redirect is cached by browsers.

    • 302 Moved Temporarily: for short-term redirections, for example, if you are redesigning or updating a page. The new URL is neither cached by browsers nor shown in search engine results.

    • 308 Redirect/Rewrite: for permanent redirections of existing dynamic pages. The URL is renamed; the new name is shown in search engine results and is cached by browsers. Use this redirect type to rename a dynamic page, for example, if you wish to rename /shop into /market.

  • URL from: Enter the URL to be redirected (e.g., /about-the-company) or search for the desired dynamic page and select it from the list.

  • URL to: For 301, 302, and 308 redirects, enter the URL to be redirected to. If you want to redirect to an external URL, include the protocol (e.g., https://).

  • 网站: 选择一个特定的网站。

  • Sequence: To define the order in which redirections are performed, e.g., in the case of redirect chains (i.e., a series of redirects where one URL is redirected to another one, which is itself further redirected to another URL).

Toggle the Activate switch to deactivate the redirection.

重要

404, 301, and 302 redirections are meant to migrate traffic from unpublished or deleted pages to new pages, while the 308 redirect is used for permanent redirections of existing pages.