Jekyll Layout Error When Using Pagination with Collections (jekyll-paginate-v2) - pagination

I'm trying to paginate a portfolio with jekyll-paginate-v2 but I'm getting unexpected output.
In my _config.yml, I've got the following:
collections:
portfolio:
output: true
pagination:
enabled: true
per_page: 6
permalink: '/page-:num/'
title: ':title — Page :num'
sort_reverse: true
trail:
before: 6
after: 6
I have a page, portfolio.html, which has the following frontmatter:
---
layout: default
title: Portfolio
pagination:
enabled: true
collection: portfolio
per_page: 9
---
That page is pulling the correct data from _portfolio, but it is using the for loop from blog.html. It doesn't matter if I add a for loop in the body of portfolio.html or leave the body blank.
The pagination is working as expected, but the layout is wrong. The debug output has no indication for layout used:
Pagination: ----------------------------
Pagination: Page: portfolio.html
Pagination: Active configuration
Pagination: Enabled: true
Pagination: Items per page: 9
Pagination: Permalink: /page-:num/
Pagination: Title: :title — Page :num
Pagination: Limit: 0
Pagination: Sort by: date
Pagination: Sort reverse: true
Pagination: Active Filters
Pagination: Collection: portfolio
Pagination: Offset: 0
Pagination: Category: [Not set]
Pagination: Tag: [Not set]
Pagination: Locale: [Not set]
Pagination: Filtering by: Category 10 => 10
Pagination: Filtering by: Tag 10 => 10
Pagination: Filtering by: Locale 10 => 10
Pagination: Rolling through the date fields for all documents
Pagination: Complete, processed 2 pagination page(s)
---
If I delete the blog.html file, the for loop in portfolio.html works as expected. If I enable autopages for collections it works as expected. However, as best as I can tell, this will restrict me to one for loop for all collections.
Is there anyway to get a for loop to work for collections without autopages?

Related

Removing Paginated URLs From jekyll-sitemap

How to Remove Paginated URLs From Jekyll-sitemap ⬇
pagination:
enabled: true
per_page: 6
offset: 0
permalink: "/page/:num/"
title: ":title - page :num of :max"
limit: 0
sort_field: date
sort_reverse: true
I am using pagination v2,
I tried
paginate_path: "/blog/page/:num/"
defaults:
- scope:
path: "blog/page"
values:
sitemap: false
and
paginate_path: "/blog/:num/"
defaults:
- scope:
path: "blog"
values:
sitemap: false
etc.
As I tried all possible solutions getting from research but nothing works in my case so I suggest adding
sitemap: false
in the front matter of your
/blog/
page, this will remove all the pages generated by the paginator but this will also remove /blog/ URL so, for this, you have to make a new .md file with only
permalink: "/blog/"
and redirect this link to your main blog page such as
it may help you 👍

Paginate in revert order with mongoose-paginate-v2

Is it possible to paginate mongodb in revert order, using mongoose-paginate-v2 given that I have field: createdAt.
For example, my collection have docs: 1-2-3-4-5-6-7-8-9-10
1 is the first doc to be created, 10 is the lastest/newest doc.
When I use mongoose-paginate-v2 to paginate that collection, the pagination work this way:
with page size = 3, it returns: page1: 1-2-3, page2: 4-5-6, page3: 7-8-9, page4: 10.
How can I use mongoose-paginate-v2 to have result like:
page1: 10-9-8, page2: 7-6-5, page3: 4-3-2, page4: 1
This is the package: https://www.npmjs.com/package/mongoose-paginate-v2
You can pass sort option as an argument to paginate method as per the documentation.
E.g.
const options = { sort: { createdAt: -1 }}
Model.paginate(yourQuery, options)

RichEditor Snippets and Nested Relations Rendering

OctoberCMS Build: 469
PHP Version: 7.3
Database Engine: MySQL
Plugins Installed: Rainlab.Builder, Rainlab.Translate, Inetis.RichEditorSnippets, Rainlab.Pages
Description:
I have followed the tutorial to make List and Form with nested Relations (https://octobercms.com/support/article/ob-21).
I open a model, and inside this model, i have a relation that have many relations like below :
-- Residence
--- Pages
---- Sections
In the "Section" popup, i display a richeditor, with snippets. But when i click on the snippet to open and edit properties, it can't focus the input.
I have search a long time in the source code of all OctoberCms, but i did not find anything.
After many tries, i have found that if in the browser inspector, i delete formPopups, the focus enables.
Here is an example of what i have actually.
Here is an example where i delete the second popup in the browser inspector
Does someone already had this issue ? Is there any fix for ?
EDIT :
Steps to reproduce
To help you to reproduce this,
you need to make 3 models with those fields :
1. Residence - fields.yaml
fields:
name:
label: Residence
span: left
required: 1
type: text
pages:
type: partial
path: pages
home_content:
label: 'Residence Content'
size: large
span: full
type: richeditor
2. Page - fields.yaml
fields:
title:
label: Titre
span: left
required: 1
type: text
sections:
span: full
path: pages_sections
type: partial
3. Section - fields.yaml
fields:
title:
label: Title
span: left
required: 1
type: text
content:
label: Content
size: ''
span: full
required: 1
type: richeditor
And you need to create relations in your models :
Residence.php
public $hasMany = [
'pages' => [
'Author\Plugin\Models\Page'
]
];
Page.php
public $hasMany = [
'sections' => [
'Author\Plugin\Models\Section'
]
];
Then you need to follow the tutorial on Making form with nested relations (https://octobercms.com/support/article/ob-21) to be able to open the relation between Page and Section inside the Residence Form.
Do not hesitate to ask me for more informations,
Best,

How to disable pagination in feathers service?

Hi I try populate my datatable using feathers service in this way:
app.service('pupils').find({}, (error, result) => {
$('#pupils > table').DataTable({
"pageLength": view.short,
"lengthChange": false,
"info" : false,
"responsive": true,
"data": result.data,
"deferRender": true,
"columns": [ ... ]
});
});
I have more than 100 testing records but in callback I receive only 10 records.
I receive more records after added below code in feathers service:
paginate: {
default: 100,
max: 200
}
but I would like to disable pagination for received all records from mongo.
How can I do that?
To disable pagination, remove the paginate option. Not recommended for production however since it might bring down both, the client and the server if you try to send many thousands of records.
Note: the response object changes depending on whether you are using pagination:
Response with pagination: object with data array property
{
total: 572,
limit: 50,
skip: 4,
data: [/* the data is here */]
}
Response without pagination: the data array
[/* the data is here */]
As #daff already pointed out in the answer above, you can disable Pagination in your configuration, although this is really not recommended.
Also you can disable pagination for a service call once in the service call.
service.find({ paginate:false})
This was discussed on Github here
The documentation for this feature can be found here

Why is sails.js limiting responses by default?

I created a default sails.js install with all default options on top of a simple mysql database. Currently, I have a table with 91 records.
I have an ionic front end that loads the list in that table, but it's displaying 30 records.
I used postman to hit the sails.js url (http://localhost:1337/list) and that is showing 30 records returned).
While it's a duplicate effort, I hit the url (http://localhost:1337/list) directly in a browser and it still returns 30 records.
Is there a default to how many records sails.js will return?
If so, how do I remove this default so sails.js will return all the results rather than a subset? I don't want to paginate, I want the full list.
PS I have checked the sails.js model I created to verify I don't have any funky limiting stuff and it's uber barebones.
I have no custom code and the entire sails.js install is the default minus the db connection, the skeleton controller, and the models.
Here's my model:
module.exports = {
identity: 'List',
attributes: {
id: {
type: 'integer',
primaryKey: true
},
name: {
type: 'string',
unique: true,
required: true
},
user: {
type: 'integer'
}
}
};
You are using blueprints for find action.
Go inside config/blueprints.js file and check all comments...
There you will find:
/****************************************************************************
* *
* The default number of records to show in the response from a "find" *
* action. Doubles as the default size of populated arrays if populate is *
* true. *
* *
****************************************************************************/
// defaultLimit: 30
Change it as you prefer.

Resources