Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

pages-with-liquid-titles.js 884 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  1. #!/usr/bin/env node
  2. // [start-readme]
  3. //
  4. // This is a temporary script to visualize which pages have liquid
  5. // (and conditionals) in their `title` frontmatter
  6. //
  7. // [end-readme]
  8. const { loadPages } = require('../lib/pages')
  9. const patterns = require('../lib/patterns')
  10. async function main () {
  11. const pages = await loadPages()
  12. const liquidPages = pages
  13. .filter(page => page.title && patterns.hasLiquid.test(page.title))
  14. .map(({ relativePath, title }) => {
  15. return { relativePath, title }
  16. })
  17. console.log(`\n\n${liquidPages.length} pages with liquid titles`)
  18. console.log(JSON.stringify(liquidPages, null, 2))
  19. const conditionalPages = liquidPages
  20. .filter(page => page.title.includes('{% if'))
  21. console.log(`\n\n\n\n${conditionalPages.length} pages with conditionals in their titles`)
  22. console.log(JSON.stringify(conditionalPages, null, 2))
  23. }
  24. main()
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...