1

I can't find any information on available macros for the name-pattern in OpenCMS, besides the %(number) one.

Are there any other macros?

I try to achieve something like %(title)_%(year)%(month)%(day).html.

However, OpenCMS doesn't recognize these macros and in the official documentation they only mention the %(number) macro.

greenit
  • 13
  • 3

1 Answers1

0

I would say that %(number) is the only one available.

Can't see anything else in I_CmsFileNameGenerator: http://documentation.opencms.org/javadoc/core/org/opencms/loader/I_CmsFileNameGenerator.html#MACRO_NUMBER

(It's also the only one I have ever used; I think for anything else you will probably need to write your own logic/macro.)

Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192
  • Thanks for the info. Do you know how I can use my own NameGenerator after I've written it? I doubt that I'll only have to write it and use the defined macro. ;-) – greenit Mar 08 '16 at 08:15
  • You probably need to overwrite the relevant class. You can search for MACRO_NUMBER in the sources: https://github.com/alkacon/opencms-core/search?utf8=%E2%9C%93&q=MACRO_NUMBER and then you see that it's probably this class "CmsDefaultFileNameGenerator.java" that you cold overwrite (i.e. wrap it in your own jar file and overwrite the existing one). It's been quite a few years since I last OpenCms quite a lot, but that would be the approach I would use. (I think I had searched about the same or similar question back then and ended up just using numbers in the end.) – Mathias Conradt Mar 08 '16 at 08:21
  • Thanks, i'll try that. :) – greenit Mar 08 '16 at 13:39