Closed npofopr closed 11 years ago
I had a look at your repository and I think you are not using the paging correctly.
You need to have something like this somewhere to render the posts, and show the paging controls.
<% posts = @getCollection('posts') %>
<% for i in [@document.page.startIdx...@document.page.endIdx]: %>
<% document = posts.at(i).toJSON() %>
<article id="post" class="post">
<h2><a href='<%=document.url%>'><%= document.title %></a></h2>
<div class="post-date"><%= document.date.toLocaleDateString() %></div>
<div class="post-content">
<%- document.contentRenderedWithoutLayouts %>
</div>
</article>
<hr/>
<% end %>
<ul class="pager">
<% if !@getDocument().hasNextPage(): %>
<li class="previous disabled"><span>← Older</span></li>
<% else: %>
<li class="previous"><a href="<%= @getDocument().getNextPage() %>">← Older</a></li>
<% end %>
<% if !@getDocument().hasPrevPage(): %>
<li class="next disabled"><span>Newer →</span></li>
<% else: %>
<li class="next"><a href="<%= @getDocument().getPrevPage() %>">Newer →</a></li>
<% end %>
</ul>
I have tested with Node 0.10 and had no problems.
Hope that helps.
I'm use (https://github.com/npofopr/_altyncev/blob/master/src/documents/posts.html.eco):
<% posts = @getCollection('posts') %>
<% for i in [@document.page.startIdx...@document.page.endIdx]: %>
<% document = posts.at(i).toJSON() %>
<article class="post">
<p class="posts_date"><%= @formatDate(document.date) %></p>
<a href="<%= document.url %>"><h3><%= document.title %></h3></a>
<div class="post-content"><%- @getCuttedContent(String(document.contentRenderedWithoutLayouts)) %></div>
<% if @hasReadMore(String(document.contentRenderedWithoutLayouts)): %>
<div class="read_more"><a href="<%= document.url %>"><strong>Читать далее →</strong></a></div>
<% end %>
</article>
<% end %>
and
<div class="pagination">
<ul>
<% if !@getDocument().hasNextPage(): %>
<li class="previous disabled"><span>← Older</span></li>
<% else: %>
<li class="previous"><a href="<%= @getDocument().getNextPage() %>">← Older</a></li>
<% end %>
<% if !@getDocument().hasPrevPage(): %>
<li class="next disabled"><span>Newer →</span></li>
<% else: %>
<li class="next"><a href="<%= @getDocument().getPrevPage() %>">Newer →</a></li>
<% end %>
</ul>
</div>
Code is similar. But if i use node: 0.10, this code don't work. May be conflict with other plugins...
maybe, if i npm install -g docpad@6.32
=>
npm http GET https://registry.npmjs.org/formidable/-/formidable-1.0.13.tgz
npm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.13.tgz
npm WARN engine formidable@1.0.13: wanted: {"node":"<0.9.0"} (current: {"node":"v0.10.4","npm":"1.2.18"})
and console error log:
npm http 200 https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.4.0.tgz
make: Entering directory `/tmp/build_uprc6czzwdgn/node_modules/docpad-plugin-robotskirt/node_modules/robotskirt/build'
CC(target) Release/obj.target/sundown/src/autolink.o
CC(target) Release/obj.target/sundown/src/buffer.o
npm http GET https://registry.npmjs.org/event-emitter
npm http GET https://registry.npmjs.org/next-tick
CC(target) Release/obj.target/sundown/src/houdini_href_e.o
CC(target) Release/obj.target/sundown/src/houdini_html_e.o
CC(target) Release/obj.target/sundown/src/houdini_html_u.o
In file included from ../src/houdini_html_u.c:6:
html_unescape.gperf: In function 'find_entity':
html_unescape.gperf:122: warning: missing initializer
html_unescape.gperf:122: warning: (near initialization for 'wordlist[0].utf8_len')
html_unescape.gperf:122: warning: missing initializer
html_unescape.gperf:122: warning: (near initialization for 'wordlist[1].utf8_len')
html_unescape.gperf:122: warning: missing initializer
html_unescape.gperf:122: warning: (near initialization for 'wordlist[2].utf8_len')
html_unescape.gperf:122: warning: missing initializer
html_unescape.gperf:122: warning: (near initialization for 'wordlist[3].utf8_len')
html_unescape.gperf:123: warning: missing initializer
html_unescape.gperf:123: warning: (near initialization for 'wordlist[4].utf8_len')
html_unescape.gperf:123: warning: missing initializer
html_unescape.gperf:123: warning: (near initialization for 'wordlist[5].utf8_len')
html_unescape.gperf:123: warning: missing initializer
html_unescape.gperf:123: warning: (near initialization for 'wordlist[6].utf8_len')
html_unescape.gperf:123: warning: missing initializer
html_unescape.gperf:123: warning: (near initialization for 'wordlist[7].utf8_len')
html_unescape.gperf:124: warning: missing initializer
html_unescape.gperf:124: warning: (near initialization for 'wordlist[8].utf8_len')
html_unescape.gperf:124: warning: missing initializer
html_unescape.gperf:124: warning: (near initialization for 'wordlist[9].utf8_len')
In file included from ../src/houdini_html_u.c:6:
html_unescape.gperf:133: warning: missing initializer
html_unescape.gperf:133: warning: (near initialization for 'wordlist[11].utf8_len')
html_unescape.gperf:133: warning: missing initializer
...
Probably a bug in the formidable
@npofopr is reporting this again at http://stackoverflow.com/questions/17093535/heroku-docpad-paged-cleanurls-404-error/17140773?noredirect=1#comment24847681_17140773
@benjamind do you have any time to look into this?
I'll try to check locally, but on heroku not working
Cool thanks.
Locally don't work too.
My package
"engines": {
"node": "0.10",
"npm": "1.2"
},
"dependencies": {
"docpad": "6.x",
"docpad-plugin-coffeescript": "2.x",
"docpad-plugin-eco": "2.x",
"docpad-plugin-paged": "2.x",
"docpad-plugin-marked": "2.x",
"docpad-plugin-partials": "2.x",
"docpad-plugin-cleanurls": "2.x",
"docpad-plugin-stylus": "2.x",
"docpad-plugin-text": "2.x",
"docpad-plugin-related": "2.x",
"docpad-plugin-sitemap": "*",
"docpad-plugin-highlightjs": "2.x",
"moment": "*",
"docpad-plugin-tagging": "2.x"
},
"devDependencies": {
"coffee-script": "1.6.x",
"docpad-plugin-livereload": "2.x"
},
"main": "node_modules/docpad/bin/docpad-server",
"scripts": {
"start": "node_modules/docpad/bin/docpad-server"
}
and in my repo
And clean docpad width paged plugin don't work too
Hmm there are definitely some issues with this plugin and live reloads. Not sure that the issue is 0.10 related though.
I'm kinda swamped at the moment, not sure that I will get time to look into this but I will try if I can carve out a moment.
@balupton I might need to touch base with you sometime about a better way to architecture this plugin. The way its currently built is obviously quite fragile as its broken a few times now with interactions with other plugins. So perhaps there's a way we can build this that works better?
@balupton I might need to touch base with you sometime about a better way to architecture this plugin. The way its currently built is obviously quite fragile as its broken a few times now with interactions with other plugins. So perhaps there's a way we can build this that works better?
@benjamind happy to discuss, right now I'm trying to secure some funding for DocPad to allow us to all work on it more, so running a bit short too, however if you can ping me on skype sometime, perhaps I can spare a bit. Cheers :)
Sure thing...probably be a week or two for me, time is being eaten up by Burning Man projects right now ;-)
Please try out DocPad v6.44 with Paged v2.2 as there has been huge improvements in this area. Happy to re-open if it is still an issue.
Hello. My docpad repo https://github.com/npofopr/_altyncev/blob/master/package.json In what could be the problem? Paged does not work, if costs "node": "0.10". I`m downgrade "node": "0.10" => "node": "0.8", then earned. After a time (because https://github.com/docpad/docpad-plugin-paged/issues/3), but it works :-)
sorry my english, i`m use gtranslate )