Skip to content

Get filepath (relative to src) from page? #650

Answered by oscarotero
writeblankspace asked this question in Q&A
Discussion options

You must be logged in to vote

You can create a preprocessor.

site.preprocess([".md"], (pages) => {
  for (const page of pages) {
    const match = page.data.url.match(/*regular expression */);
    if (match) {
      const [, , year, month, day] = match;
      page.data.date = new Date(year, month - 1, day, 0, 0, 0);
    }
  }
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@writeblankspace
Comment options

Answer selected by writeblankspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants