@@ -308,26 +308,31 @@ public function summary($size = null)
308
308
return $ content ;
309
309
}
310
310
311
- // Return calculated summary based on summary divider 's position
312
- if (! $ size && isset ( $ this -> summary_size )) {
313
- return substr ( $ content , 0 , $ this -> summary_size );
311
+ // Get summary size from site config 's file
312
+ if (is_null ( $ size )) {
313
+ $ size = $ config -> get ( ' site.summary.size ' , null );
314
314
}
315
315
316
- // Return calculated summary based on setting in site config file
317
- if (is_null ($ size ) && $ config ->get ('site.summary.size ' )) {
318
- $ size = $ config ->get ('site.summary.size ' );
316
+ // Return calculated summary based on summary divider's position
317
+ $ format = $ config ->get ('site.summary.format ' , 'short ' );
318
+ // Return entire page content on wrong/ unknown format
319
+ if (!in_array ($ format , array ('short ' , 'long ' ))) {
320
+ return $ content ;
321
+ } elseif (($ format === 'short ' ) && isset ($ this ->summary_size )) {
322
+ return substr ($ content , 0 , $ this ->summary_size );
319
323
}
320
324
325
+ // If the size is zero, return the entire page content
326
+ if ($ size === 0 ) {
327
+ return $ content ;
321
328
// Return calculated summary based on defaults
322
- if (!is_numeric ($ size ) || ($ size < 0 )) {
329
+ } elseif (!is_numeric ($ size ) || ($ size < 0 )) {
323
330
$ size = 300 ;
324
331
}
325
332
326
333
return Utils::truncateHTML ($ content , $ size );
327
334
}
328
335
329
-
330
-
331
336
/**
332
337
* Gets and Sets the content based on content portion of the .md file
333
338
*
0 commit comments