The WeblogPlugin is a JSPWikiPlugin that builds a simple weblog.
A weblog is a list of wiki pages with a common name prefix, each page is an entry. Page names are like DemoBlog_blogentry_100816_2.
The WeblogPlugin reads all pages that start with the prefix and displays them. The WeblogEntryPlugin creates a link to the new entry editor.
Parameters#
- page - name prefix for pages that are used as blog entry pages, default is name of the current page.
- days - how many days the weblog aggregator should show. If set to "all", shows all pages.
- startDate - Date when to start. Format is "ddMMyy";
- maxEntries - How many entries to show at most.
- entryFormat - SimpleDateFormat pattern for date that is displayed over entries. Default is the Wiki DateFormat.
- preview - shortens the blog post to the given characters, more or less; we try to keep entire paragraphs on the preview, in order to get a (hopefully) better well-formed html.
The "days" and "startDate" can also be sent in HTTP parameters, and the names are "weblog.days" and "weblog.startDate", respectively.
Weblog entry page prefix is "%p_blogentry_". %p is replaced by the page parameter, if given, else by the current page name.
Creating a Blog#
On a wiki page that contains a blog you need the
- WeblogEntryPlugin : to create a link to the editor for a new blog entry
- WeblogPlugin : reads and displays all wiki pages belonging to the blog (i.e. whose names start with the weblog prefix)
Weblog page#
Here's an example blog or "News" page:
[{WeblogEntryPlugin entrytext='Create a new blog entry.'}] ---- [{WeblogPlugin days='90' allowComments='true'}]
Note that if a blog entry page starts with a heading it will be used as the entry title (e.g., "! My Title"), else the generated page name will be used as title.
Questions & Answers#
- Q) And how do I write the blog?? To me it seems that one should also add New entry to the same page to get the New entry button. Is there a localized version? --Boris Folgmann
- A) Yes, you'll have to add the WeblogEntryPlugin, not necessarily on the same page, though. It has a page parameter to refer to a Weblog on another page. The only localization you can do is use the entrytext parameter. -- Jawe
A) Please consider that the parameter page is a feature of the newer 2.1 release of JSPWiki. In the current stable 2.0.52 release, the parameter page doesn't work. -- Steffen Stundzig
A) Note, that the current version 2.1.103a does not support page in WeblogEntryPlugin. page is always encoded as engine.encodeName(weblogName) which is in turn context.getPage().getName() - see com.ecyrd.jspwiki.plugin.WeblogEntryPlugin.java, line 83 -- Olaf Kock
- Q) My blog entries seem to be dissappearing after a few days whatever the days parameter is set to. I've tried the default 180, and all. I want all the entries to stay forever. Any ideas? -- Chris Harris
- A) IIRC you'll also have to add days=all --Jawe
- Q) I would like to know how to use the pageformat parameter. Thanks. -- ilmazozz
- Q) Indeed, how to use this feature? Whatever I do the output stays same. -- juhnu
- A) Quick answer: pageformat defines the way the weblog page title is formatted (i.e. Main_blogentry_ddMMYY_N)
- Q) Blog entries are never shown. Files are created correctly but then nothing is displayed. I'm obviously doing something wrong. Can anyone shed a light here plz? Thnx. --ncorreia
- Q) i am also having the same problem, any help will be apreaciated. - Chris
- A) One way is to set the 'days' parameter to 'all.'
A) You need to use the WeblogPlugin to display the pages created by the WeblogEntryPlugin. If the WeblogEntryPlugin is on a different page, then set you must set the page attribute of the WeblogPlugin to that page.
- Q) Is it possible to show only a part of the blog-entries... for example just the first 5 lines or something else? -- MartinU
- A) As of 2.11.0.M5, you can use the preview parameter.
- Q) Can you create separate pages pointing to the same blog content? I'd like to have a page with days='all' and another with days='7'.
- A) Yes, that should work fine.
- Q) How do you edit a blog entry? (sorry if that's a dumb question ;) ) -- Dorothy Valiga, 10-Jun-2009
- A) You follow the permalink at the bottom of the entry. -- Keith W
See: JSPWikiCorePlugins
Category.Plugins