Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource type for detail pages #769

Closed
AnnJul opened this issue Jul 12, 2023 · 1 comment
Closed

Resource type for detail pages #769

AnnJul opened this issue Jul 12, 2023 · 1 comment

Comments

@AnnJul
Copy link
Contributor

AnnJul commented Jul 12, 2023

While creating the link for a detail page (CmsDefaultDetailPageHandler.java), the resource type of the resource is not read from the resource itself but from the parent folder (defined in the module config). If more than one resource type is in the same content folder, the link creation fails, because the latest entry in the config overrides the other.

Example:
Resource types in module config

<ResourceType>
      <TypeName><![CDATA[announcement]]></TypeName>
      <Disabled><![CDATA[false]]></Disabled>
      <Folder>
        <Name><![CDATA[support]]></Name>
      </Folder>
      <NamePattern><![CDATA[announcement_%(number).xml]]></NamePattern>
      <ElementView/>
</ResourceType>
<ResourceType>
      <TypeName><![CDATA[faq]]></TypeName>
      <Disabled><![CDATA[false]]></Disabled>
      <Folder>
        <Name><![CDATA[support]]></Name>
      </Folder>
      <NamePattern><![CDATA[faq_%(number).xml]]></NamePattern>
      <ElementView/>
</ResourceType>

JSP for announcement entry with a link to its detail page:
<cms:link>${content.filename}</cms:link>
--> filename: /support/announcement_00001.xml

public String getDetailPage(
        CmsADEManager manager,
        CmsObject cms,
        String contentRootPath,
        String originPath,
        String targetDetailPage) {

        boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject();
        String resType = manager.getParentFolderType(online, contentRootPath);
...

CmsADEManager.getParentFolderType(true, '/.content/support/')
--> faq (not announcement)
--> no detail page link created

gWestenberger added a commit that referenced this issue Sep 19, 2023
folder (github issue #769).

Note that the folder that the linked content is in must still be the
content folder of *some* type configured in the sitemap configuration.
@gWestenberger
Copy link
Contributor

Implemented in master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants