开发者

OpenCMS - howto explose a flat structure instead of a folder/tree structure

I would like to have a tree/ folder structure for my content but would like all pages to be served as a flat URL. E.g.

the page located at /cat1/subcat2/tulips.html would be served at:

http://example.com/tulips.html

and the page located at /cat5/roses.html would be served at:

http://example.com/roses.html

I would need all links to be automatically calculated and ensure that there are no conflicts.

Is this开发者_如何学编程 possible with opencms?

Thanks,

Assaf


A rough outline how I'd to approach this:

You would first get the list of all the resources via <cms:contentload> (http://www.bng-galiza.org/opencms/opencms/alkacon-documentation/documentation_taglib/docu_tag_contentload.html), taglib or the respective java API in java code as you need some coding anyway, and then create new resources of type 'external link' in your OpenCms root folder, pointing to your targets; probably using something like

getCms().createResource(newFileName, templateFile.getTypeId());

or similar method (as external link isn't structured content) for it.

You could wrap this logic up into a java class and schedule it as a scheduled job, I guess it's sufficient, as long as you don't need it right away and some delay is acceptable. Otherwise you'd need to hook it into the publishing flow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜