Skip to content

Permalinks can provide the default value of template variable like year,month,day #1923

@fangbinwei

Description

@fangbinwei

Feature request

What problem does this feature solve?

Provide reasonable default value for template variable such as year, month, day

What does the proposed API look like?

null

How should this be implemented in your opinion?

like what @vuepres/plugin-last-updated did

if DATE_REnot match the date in filename,dirname, and frontmatter.date is not provided, we can find the commit where this file was first added( i'm not sure if it will course performance problem in large repo)

    addedTimeStamp =
      parseInt(
        spawn
          .sync(
            'git',
            [
	      'log',
	      '--follow', // continue listening the history of renamed file
	      '--diff-filter=A',
	      '--format=%at',
	      path.basename(filePath)
	    ],
            {
              cwd: path.dirname(filePath)
            }
          )
          .stdout.toString('utf-8')
      ) * 1000

I wrote my own plugin to set frontmatter.date. It's cool if offical can provide this feature(maybe not necessary).

Are you willing to work on this yourself?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions