@@ -21,7 +21,7 @@ fn can_parse_site() {
21
21
let library = site. library . read ( ) . unwrap ( ) ;
22
22
23
23
// Correct number of pages (sections do not count as pages, draft are ignored)
24
- assert_eq ! ( library. pages. len( ) , 36 ) ;
24
+ assert_eq ! ( library. pages. len( ) , 37 ) ;
25
25
let posts_path = path. join ( "content" ) . join ( "posts" ) ;
26
26
27
27
// Make sure the page with a url doesn't have any sections
@@ -44,7 +44,7 @@ fn can_parse_site() {
44
44
45
45
let posts_section = library. sections . get ( & posts_path. join ( "_index.md" ) ) . unwrap ( ) ;
46
46
assert_eq ! ( posts_section. subsections. len( ) , 2 ) ;
47
- assert_eq ! ( posts_section. pages. len( ) , 10 ) ; // 11 with 1 draft == 10
47
+ assert_eq ! ( posts_section. pages. len( ) , 12 ) ; // 13 with 1 draft == 12
48
48
assert_eq ! ( posts_section. ancestors, vec![ index_section. file. relative. clone( ) ] ) ;
49
49
50
50
// Make sure we remove all the pwd + content from the sections
@@ -155,6 +155,47 @@ fn can_build_site_without_live_reload() {
155
155
"posts/tutorials/devops/nix.md"
156
156
) ) ;
157
157
158
+ assert ! ( file_exists!( public, "posts/access-render/index.html" ) ) ;
159
+
160
+ // render = false pages can still be accessed directly
161
+ assert ! ( file_contains!(
162
+ public,
163
+ "posts/access-render/index.html" ,
164
+ "Path of unrendered page: /posts/render/"
165
+ ) ) ;
166
+ // render = false pages can still be accessed through sections
167
+ assert ! ( file_contains_regex!(
168
+ public,
169
+ "posts/access-render/index.html" ,
170
+ r#"Pages in section with unrendered page: <ul>(<li>[^>]+</li>)*<li>/posts/render/</li>"#
171
+ ) ) ;
172
+ // render = false sections can still be accessed directly
173
+ assert ! ( file_contains!(
174
+ public,
175
+ "posts/access-render/index.html" ,
176
+ "Pages in unrendered section: <ul><li>"
177
+ ) ) ;
178
+ // render = false pages don't show up in taxonomies
179
+ assert ! ( !file_contains!(
180
+ public,
181
+ "podcast-authors/some-person/atom.xml" ,
182
+ "/posts/render/"
183
+ ) ) ;
184
+ assert ! ( !file_contains!(
185
+ public,
186
+ "categories/a-category/atom.xml" ,
187
+ "/posts/render/"
188
+ ) ) ;
189
+ // render = false pages don't even add terms to taxonomies
190
+ assert ! ( !file_exists!(
191
+ public,
192
+ "podcast-authors/other-person/atom.xml"
193
+ ) ) ;
194
+ assert ! ( !file_exists!(
195
+ public,
196
+ "categories/b-category/atom.xml"
197
+ ) ) ;
198
+
158
199
// aliases work
159
200
assert ! ( file_exists!( public, "an-old-url/old-page/index.html" ) ) ;
160
201
assert ! ( file_contains!( public, "an-old-url/old-page/index.html" , "something-else" ) ) ;
@@ -216,6 +257,8 @@ fn can_build_site_without_live_reload() {
216
257
assert ! ( !file_contains!( public, "sitemap.xml" , "draft" ) ) ;
217
258
// render: false sections are not in the sitemap either
218
259
assert ! ( !file_contains!( public, "sitemap.xml" , "posts/2018/</loc>" ) ) ;
260
+ // render: false pages are not in the sitemap either
261
+ assert ! ( !file_contains!( public, "sitemap.xml" , "posts/render/</loc>" ) ) ;
219
262
220
263
// robots.txt has been rendered from the template
221
264
assert ! ( file_contains!( public, "robots.txt" , "User-agent: zola" ) ) ;
@@ -417,7 +460,7 @@ fn can_build_site_with_pagination_for_section() {
417
460
"posts/page/1/index.html" ,
418
461
"http-equiv=\" refresh\" content=\" 0; url=https://replace-this-with-your-url.com/posts/\" "
419
462
) ) ;
420
- assert ! ( file_contains!( public, "posts/index.html" , "Num pagers: 5 " ) ) ;
463
+ assert ! ( file_contains!( public, "posts/index.html" , "Num pagers: 6 " ) ) ;
421
464
assert ! ( file_contains!( public, "posts/index.html" , "Page size: 2" ) ) ;
422
465
assert ! ( file_contains!( public, "posts/index.html" , "Current index: 1" ) ) ;
423
466
assert ! ( !file_contains!( public, "posts/index.html" , "has_prev" ) ) ;
@@ -430,12 +473,12 @@ fn can_build_site_with_pagination_for_section() {
430
473
assert ! ( file_contains!(
431
474
public,
432
475
"posts/index.html" ,
433
- "Last: https://replace-this-with-your-url.com/posts/page/5 /"
476
+ "Last: https://replace-this-with-your-url.com/posts/page/6 /"
434
477
) ) ;
435
478
assert ! ( !file_contains!( public, "posts/index.html" , "has_prev" ) ) ;
436
479
437
480
assert ! ( file_exists!( public, "posts/page/2/index.html" ) ) ;
438
- assert ! ( file_contains!( public, "posts/page/2/index.html" , "Num pagers: 5 " ) ) ;
481
+ assert ! ( file_contains!( public, "posts/page/2/index.html" , "Num pagers: 6 " ) ) ;
439
482
assert ! ( file_contains!( public, "posts/page/2/index.html" , "Page size: 2" ) ) ;
440
483
assert ! ( file_contains!( public, "posts/page/2/index.html" , "Current index: 2" ) ) ;
441
484
assert ! ( file_contains!( public, "posts/page/2/index.html" , "has_prev" ) ) ;
@@ -448,11 +491,11 @@ fn can_build_site_with_pagination_for_section() {
448
491
assert ! ( file_contains!(
449
492
public,
450
493
"posts/page/2/index.html" ,
451
- "Last: https://replace-this-with-your-url.com/posts/page/5 /"
494
+ "Last: https://replace-this-with-your-url.com/posts/page/6 /"
452
495
) ) ;
453
496
454
497
assert ! ( file_exists!( public, "posts/page/3/index.html" ) ) ;
455
- assert ! ( file_contains!( public, "posts/page/3/index.html" , "Num pagers: 5 " ) ) ;
498
+ assert ! ( file_contains!( public, "posts/page/3/index.html" , "Num pagers: 6 " ) ) ;
456
499
assert ! ( file_contains!( public, "posts/page/3/index.html" , "Page size: 2" ) ) ;
457
500
assert ! ( file_contains!( public, "posts/page/3/index.html" , "Current index: 3" ) ) ;
458
501
assert ! ( file_contains!( public, "posts/page/3/index.html" , "has_prev" ) ) ;
@@ -465,11 +508,11 @@ fn can_build_site_with_pagination_for_section() {
465
508
assert ! ( file_contains!(
466
509
public,
467
510
"posts/page/3/index.html" ,
468
- "Last: https://replace-this-with-your-url.com/posts/page/5 /"
511
+ "Last: https://replace-this-with-your-url.com/posts/page/6 /"
469
512
) ) ;
470
513
471
514
assert ! ( file_exists!( public, "posts/page/4/index.html" ) ) ;
472
- assert ! ( file_contains!( public, "posts/page/4/index.html" , "Num pagers: 5 " ) ) ;
515
+ assert ! ( file_contains!( public, "posts/page/4/index.html" , "Num pagers: 6 " ) ) ;
473
516
assert ! ( file_contains!( public, "posts/page/4/index.html" , "Page size: 2" ) ) ;
474
517
assert ! ( file_contains!( public, "posts/page/4/index.html" , "Current index: 4" ) ) ;
475
518
assert ! ( file_contains!( public, "posts/page/4/index.html" , "has_prev" ) ) ;
@@ -482,7 +525,7 @@ fn can_build_site_with_pagination_for_section() {
482
525
assert ! ( file_contains!(
483
526
public,
484
527
"posts/page/4/index.html" ,
485
- "Last: https://replace-this-with-your-url.com/posts/page/5 /"
528
+ "Last: https://replace-this-with-your-url.com/posts/page/6 /"
486
529
) ) ;
487
530
488
531
// sitemap contains the pager pages
0 commit comments