legacy-knowledge-base
公開されました Sep. 10, 2025

カスタムテーマでClassicテーマの検索ボックスを再現するにはどうすればよいですか?

written-by

Alfonso Crisci

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • 既成のクラシックテーマを適用した場合、デフォルトで検索ボックスが表示されません。 Search Pagesの設定に続き、Global Templatesに記載されているSearch Templateを使用した「Search Page」を作成し、目的地を設定することでSearchボックスを表示させることが可能です。

    しかし、 Theme 、それを同じサイトやページに適用すると、Search boxが消えてしまうのです。

Environment

  • Liferay DXP 7.0+

解決策

  • 1) Global "Search" Page Template (more info here: https://help.liferay.com/hc/en-us/articles/360028821052-Configuring-Search-Pages#manual-search-page-configuration)
    2) その設定で、ページ を hidden from Navigation Menu
    3) 次に、テーマの portal_normal.ftlで以下のコードを使用します:
    <#assign preferences = freeMarkerPortletPreferences.getPreferences({"portletSetupPortletDecoratorId": "barebone", "destination": "/mycustompage"}) />

    <div class="autofit-col autofit-col-expand">
    <div class="justify-content-md-end mr-4 navbar-form" role="search">
    <@liferay_portlet["runtime"]
    defaultPreferences="${preferences}"
    portletName="com_liferay_portal_search_web_search_bar_portlet_SearchBarPortlet"
    instanceId="FOOTER${plid}"
    />
    </div>
    </div>
    いくつか注意点があります:

    - 宛先 ページ
    - ポートレットに一意の instanceId を与えます(この場合、 フッター ID に基づいていますが、動的に一意の値を得るのに役立つ他の変数を自由に使ってください)
    - ポートレット名 com_liferay_portal_search_web_search_bar_portlet_SearchBarPortlet <@liferay.search_bar /> taglib

did-this-article-resolve-your-issue

legacy-knowledge-base