页面

Odoo allows you to create pages for your website and customize their content and appearance to your needs.

Static pages, such as the homepage or any custom-created, contain fixed content that does not change dynamically. You can manually create these pages, define their URLs, and adapt their properties as needed. 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.

页面创建

网站页面可以从**前台**和**后台**创建。创建新网站页面的步骤如下:

    • 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. In the New Page selection menu, click on a template. They are sorted by type:

    • Basic: Multi-purpose page. A blank page is also available to start from scratch.

    • About: Information about your brand.

    • Landing Pages: Summary of company content and info.

    • Gallery: Photos and media showcase.

    • Services: Focus on what you’re selling and contact.

    • Pricing Plans: Highlight on subscription and prices.

    • Team: The people behind your company.

    • Custom: To select a custom template. To add a template to this category, open the page you want to save as a template, then go to Site ‣ Properties, enter the Page Title, edit the page’s properties, enable Is a template, and click Save.

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

  3. 点击:guilabel:创建

  4. If needed, customize the page’s content and appearance using the website editor, then click Save.

  5. Publish the page.

小技巧

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

页面管理

发布/取消发布页面

Pages need to be published to make them visible 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.

Unpublished/Published toggle

注解

It is also possible to:

  • 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.

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, where you can change the following properties:

  • Page URL : Modify the page URL in the field. In this case, you can redirect the old URL to the new one if needed. To do so, enable Redirect old URL, then select the Type of redirection:

    • 301 Moved permanently: to redirect the page permanently.

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

    重定向旧 URL
  • In Menu: Disable if you don’t want the page to appear in the menu.

  • Is Homepage: Enable if you want the page to be the homepage of your website.

  • Published: Enable to publish the page.

  • Publishing Date: To publish the page at a specific date and time, click the field, set the date and time, then press Enter or click Apply to validate your selection.

  • Indexed: Disable if you don’t want the page to appear in search engine results.

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

    • Public: Everyone can access the page.

    • Signed In: Only signed-in users can access the page.

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

    • With Password: Type the password required to access the page in the Password field.

  • Is a template: Toggle the switch to save the page as a template and add it to the Custom category.

小技巧

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

复制页面

To duplicate a page, access the page, then go to Site ‣ Properties, and click Duplicate Page. Enter a Page Name, then click OK. By default, the new page is added after the duplicated page in the menu, but you can remove it from the menu or change its position using the menu editor.

删除网页

删除页面的步骤如下:

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

  2. A pop-up window shows all links referring to the page you want to delete, organized by category. To ensure website visitors don’t land on an error page, you must update all the links on your website referring to the page. To do so, expand a category, then click on a link to open it in a new window. Alternatively, you can set up a redirection for the deleted page.

  3. Once you have updated the links (or set up a redirection), tick the I am sure about this check box, then click OK.

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 Search Engine Optimization (SEO).

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

注解

要创建新的重定向,请点击 新建 按钮,然后填写字段:

  • 名称:输入名称以标识重定向。

  • 操作:选择重定向类型:

    • 404 未找到页面:当访问者试图访问未发布或已删除的页面时,会被重定向到 404 错误页面。

    • 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 暂时移动:用于短期重定向,例如,在重新设计或更新页面时。新 URL 既不会被浏览器缓存,也不会显示在搜索引擎结果中。

    • 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.