|
|
Rank: Devotee
Joined: 3/14/2007 Posts: 47
|
Hi, We have some very long articles on our site that I want to split up into multiple pages to improve readability. A good example of what I want to achieve can be seen here: http://www.theage.com.au/articles/2007/11/12/1194766590346.htmlScroll down the bottom and you'll see a widget with "Page 1 2 3 Next Single Page" on it. I can think of multiple ways to achieve this, each with it's own pros and cons, so I thought I'd ask for advice from the experts out there, and if anyone has tackled this before see how they went about it. Options 1) Article all on one page, divide content up with id'ed DIVs or SPANs, and use JavaScript to handle the displaying and hiding of sections. Probably the simplest to build, but clunky when dividing up the content into pages.
Search engines see all content as being on one page, but will also see multiple pages with the same content (?page=2, ?page=3, etc).2) Have an "article" document type which has meta data, contents, etc for the article, with multiple child nodes of "article section" document type, which contain each chunk of the article. Render whole article on one page, and use JavaScript to displaying and hiding of sections. A little trickier to build and has potential complications with sitemaps & internal search, but probably more flexible and easier to use (from a content editting point of view).
Search engines see all content as being on one page, but will also see multiple pages with the same content (?page=2, ?page=3, etc).3) Have an "article" document type which has meta data, contents, etc for the article, with multiple child nodes of "article section" document type, which contain each chunk of the article. Render only the relevent chunk of the article on each page, so no JavaScript. Somewhere between #1 and #2 in build complexity, not as many complications with interal search and sitemaps (as long as it's fine for search / sitemaps to treat each chunk of the article as an individual page), more flexible and easier to use than #1, same as #2.
Search engines see each page of the article as a seperate page, but will not see multiple pages with the same content.4) Plain old content nodes, which are manually linked together or linked together by a macro. Not a fan of this approach as it means entering meta-data, etc, multiple times (on each "plain old content node"). 5) Anything else? Perhaps, is it possible to do #2 / #3 without using child nodes for the article chunks - i.e. have a flexible number of rich-text properties attached to a "article" document type? Appreciate any comments / feedback. Cheers, Matt
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 542 Location: Preston, UK
|
Matt, Kasper did something like this ages ago try hereRegards Ismail
Level 2 certified. If it aint broke dont fix.
|
|
Rank: Devotee
Joined: 3/14/2007 Posts: 47
|
Thanks, will read up on that.
|
|
Rank: Devotee
Joined: 3/14/2007 Posts: 47
|
As a FYI for the rest of the community, I ended up using a modified version of Kasper's idea - it was better than anything in my original pos. However, I did changed the way it worked so there's no need to create custom data-types. Instead, I used inline C# code in an XSLT macro to do the splitting. Code: Code:<msxml:script language="C#" implements-prefix="custom"> <![CDATA[
public System.Xml.XPath.XPathNodeIterator SplitMultiPageText(string unsplitText, string pageDelimeter) { System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); string[] splitPages = System.Text.RegularExpressions.Regex.Split(unsplitText, pageDelimeter);
System.Xml.XmlElement pagesElement = xmlDoc.CreateElement("pages"); foreach (string page in splitPages) { System.Xml.XmlElement pageElement = xmlDoc.CreateElement("page"); pageElement.AppendChild(xmlDoc.CreateCDataSection(page)); pagesElement.AppendChild(pageElement); }
return pagesElement.CreateNavigator().Select("."); } ]]> </msxml:script> I believe the code will require Umbraco 3 and ASP.Net 2.0 to work. This method lets you insert page break markers into the document (e.g. hr's with class="pageBreak", as per Kasper's example), and then use the above function to do the splitting in a XSLT "display" macro: Code:<xsl:for-each select="custom:SplitMultiPageText($currentPage/data[@alias = 'mainContent'], '<hr class="pageBreak" />')/page"> <xsl:value-of select="umbraco.library:RenderMacroContent(.,$currentPage/@id)" disable-output-escaping="yes" /> </xsl:for-each> The above example will just iterate through each "page" and display them all, but it would be simple to integrate with a query string identifying the correct page to display (again, as per Kasper's idea). I hope this helps anyone else trying to solve the same / a similar dilemma!
|
|
Rank: Devotee
Joined: 3/14/2007 Posts: 47
|
As a FYI for the rest of the community, I ended up using a modified version of Kasper's idea - it was better than anything in my original pos. However, I did changed the way it worked so there's no need to create custom data-types. Instead, I used inline C# code in an XSLT macro to do the splitting. Code: Code:<msxml:script language="C#" implements-prefix="custom">
public System.Xml.XPath.XPathNodeIterator SplitMultiPageText(string unsplitText, string pageDelimeter) { System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); string[] splitPages = System.Text.RegularExpressions.Regex.Split(unsplitText, pageDelimeter);
System.Xml.XmlElement pagesElement = xmlDoc.CreateElement("pages"); foreach (string page in splitPages) { System.Xml.XmlElement pageElement = xmlDoc.CreateElement("page"); pageElement.AppendChild(xmlDoc.CreateCDataSection(page)); pagesElement.AppendChild(pageElement); }
return pagesElement.CreateNavigator().Select("."); } </msxml:script> I believe the code will require Umbraco 3 and ASP.Net 2.0 to work. This method lets you insert page break markers into the document (e.g. hr's with class="pageBreak", as per Kasper's example), and then use the above function to do the splitting in a XSLT "display" macro: Code:<xsl:for-each select="custom:SplitMultiPageText($currentPage/data[@alias = 'mainContent'], '<hr class="pageBreak" />')/page"> <xsl:value-of select="umbraco.library:RenderMacroContent(.,$currentPage/@id)" disable-output-escaping="yes" /> </xsl:for-each> The above example will just iterate through each "page" and display them all, but it would be simple to integrate with a query string identifying the correct page to display (again, as per Kasper's idea). I hope this helps anyone else trying to solve the same / a similar dilemma!
|
|
Rank: Devotee
Joined: 3/14/2007 Posts: 47
|
Cave-ats to the code in the previous post due to forum "features" and posting limitations:
- All of the "wink" img tags should of course be ": )" (minus the space)
- You need to put "<![ CDATA[" and "] ]>" (minus the spaces) at the start and end of the C# code block (immediately before and after the <msxml> lines.
- The "pageDelimiter" property of the SplitMultiPageText function needs to be escaped (the forum un-escaped it for me), so the <hr class="pageBreak" /> part of the XSLT example would need to use & lt;, & gt; and & #34; instead of <, > and "
Grrr forum!
|
|
 Rank: Administration
Joined: 7/25/2006 Posts: 412 Location: vipperoed, denmark
|
I've done this using subnodes .. with the exact same result as far as I kan see. The subnodes can be iterated the same way as the <page/> tags provided by the split. Kindly, Jesper webbureau jesper.com doing webdesign / development / umbraco implementations / 2007&2008 MVP
|
|
Rank: Devotee
Joined: 3/14/2007 Posts: 47
|
Jesper Ordrup wrote: I've done this using subnodes .. with the exact same result as far as I kan see. The subnodes can be iterated the same way as the <page/> tags provided by the split.
Doing it that way achieves the same outcome, but it makes changing the pagination more of a hassle and means you need to maintain multiple sets of metadata.
|
|
 Rank: Administration
Joined: 7/25/2006 Posts: 412 Location: vipperoed, denmark
|
Matt wrote:
Doing it that way achieves the same outcome, but it makes changing the pagination more of a hassle and means you need to maintain multiple sets of metadata.
One of the easier things in Umbraco is to inherit content. On templates it's build in the dialog when you insert a field (recursive). If that doesnt fill the need then a xslt macro is - as I see it - much more flexible and elegant. Kindly, Jesper webbureau jesper.com doing webdesign / development / umbraco implementations / 2007&2008 MVP
|
|
Rank: Enthusiast
Joined: 7/21/2006 Posts: 24
|
Jesper Ordrup wrote:
One of the easier things in Umbraco is to inherit content. On templates it's build in the dialog when you insert a field (recursive). If that doesnt fill the need then a xslt macro is - as I see it - much more flexible and elegant.
I think you're missing the point Jesper ;) - the issue here is that an editor is writing an article, which are too long and needs to be broken up - due to layout/format, not necessarily into logical pieces, an editor often needs to do minor modification which leads to changes in the way the pages are split up - this will - if you use multiple documents lead to more troubled handling of content and less publishing for the editor. If you want different metadata for each page for some reason or another, there is nothing wrong with using a macro as a page splitter, this macro would hold meta data for the next bit of text (which will be a page to the website visitor) and so on. You can use url rewriting for Niceurls on subpages in the article to get rid of querystrings, so its difficult to find a reason for not using single umbraco documents for single logical article. Just my 5c
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,285 Location: KY, USA
|
I think this is related, but I can't figure out how to do it. I have a two-column design for a site. Content authors will write an lengthy article. I want to automatically split the article so that roughly half appears in the left column and half appears in the right column. I could do this with Kasper's special <HR> approach, but is there any way I could automatically split the page with a macro? What if there are images in addition to text? Is this going to have to be a manual process for the content authors? All ideas welcome! cheers, doug.
MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
|
|
 Rank: Administration
Joined: 7/25/2006 Posts: 412 Location: vipperoed, denmark
|
Kasper Bumbech wrote:
I think you're missing the point Jesper ;)
- I think you could be right Kasper. But - :D - there's so many points to make - and it's hard not to miss one some times. :yes: I see yours here and it's a great way to extend Umbraco in a flexible way that the editors will love. There's a lot of nonprogramming Umbracogorians out there which couldn't pull that one and would have to use the tools at hand. "My way" is just an easy way of solving the case without developing anything. This is why I like Umbraco so much - there's lots of ways so solve the same "problems". Kindly, Jesper webbureau jesper.com doing webdesign / development / umbraco implementations / 2007&2008 MVP
|
|
 Rank: Fanatic
Joined: 10/9/2006 Posts: 334
|
hey, could this be a possibility? http://www.mindsack.com/uxe/autoflow/
bootnumlock - aka bob baty-barr [ http://www.baty-barr.com] Level 1 Certified!
|
|
 Rank: Fanatic
Joined: 10/9/2006 Posts: 334
|
@doug... there was also this link... but it everything looks about half done... http://www.designateonline.com/discussions/comments.php?DiscussionID=3376&page=1
bootnumlock - aka bob baty-barr [ http://www.baty-barr.com] Level 1 Certified!
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,285 Location: KY, USA
|
Thanks, Bob. The more I think about it, the more I need to do a manual break. If there is an image in the text, for instance, it gets very hard to automatically determine where the break should be. I think this is one time that a human is just way more capable than a computer! (at least with my level of coding skill and available time) Of course I'm open to other ideas? Anyone? cheers, doug.
MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
|
|
Rank: Newbie
Joined: 4/2/2008 Posts: 14 Location: FRANCE
|
Hi ! Is there a new way to add a split page option to the editor ? I tried Kaspers' multipage splitter, but it does umbraco crash. I can create a new datatype with the new rendercontrol and a new document type which use it, but when a create a new page based on that document type, umbraco crash... Does anyone have a solution ?
|
|
|
Guest |