Skip to content

how to display the author and create time in every md page? #750

Closed

Description

@Jasyl0519
No description provided.

Activity

  1. Edgar-Spiir commented on Jan 21, 2019

    @Edgar-Spiir

    Not sure about the author, but you can add the date when the file was modified, by adding date format to the docsify config

    window.$docsify = {
    	formatUpdated: '{YYYY}-{MM}-{DD}',
    	...
    }
    

    and then using {docsify-updated} inside the markdown page.

    More in docs: https://github.com/docsifyjs/docsify/blob/master/docs/configuration.md#formatupdated

  2. timaschew commented on Jan 23, 2019

    @timaschew
    Member

    You can define the author via front matter and then use a docsify plugin to access the author property and render it where you want.

  3. jthegedus commented on Jan 23, 2019

    @jthegedus
    Contributor

    @timaschew an example doing so with the front-matter plugin would go a long way as it's not clear how that plugin is to be used.

  4. timaschew commented on Jan 24, 2019

    @timaschew
    Member

    Okay let's improve the documentation for that plugin.
    Do you have some concrete questions?

  5. jthegedus commented on Jan 24, 2019

    @jthegedus
    Contributor

    I used it briefly and looked through the code and it strips the front-matter successfully, but it's not clear where the attributes end up.

    vm.frontmatter = attributes;

    how to we get this vm.frontmatter data in further plugins or our pages?

  6. timaschew commented on Jan 24, 2019

    @timaschew
    Member

    Yes that was also my initial question. But then after I saw the page about writing a plugin I've realized that the vm is passed to the plugin function.

    I guess you would need to write in your markdown something like {{author}} and then in the beforeHook you can do something like

    content.replace(/{{(.*)}}/g, function(match, group) {
      return vm.frontmatter[group]
    })

    But I think it makes sense to setup a convention for variables in general in docsify and provide to replace them by frontmatter attributes and implement it into the docsify core.

  7. jthegedus commented on Jan 24, 2019

    @jthegedus
    Contributor

    Ah okay, a working example people could look at would go a long way here. I fear many people would overlook using docsify because front matter does not work as people would expect.

    I do agree that

    a convention for variables in general in docsify and provide to replace them by frontmatter attributes and implement it into the docsify core

    would go a long way and remove most of my concerns with this plugin 😄

  8. timaschew commented on Jan 29, 2019

    @timaschew
    Member

    see #758

  9. BinaryPaean commented on Dec 6, 2019

    @BinaryPaean

    I can't even figure out how to activate front-matter to simply prevent YAML frontmatter in my 'README.md' from polluting the docsify site.

    I've tried variations of:

    window.$docsify = { frontMatter: true }
    window.$docsify = { front-matter: true }
    windows.$docsify = { front-matter: 'README.md' }
    ...

    With no success. Can anyone point me at basic usage?

  10. szkiba commented on Feb 4, 2020

    @szkiba

    You can substitute variables with docsify-mustache plugin using mustache syntax {{variable}}. Variables can be defined in front matter, external JSON|XML files or in docsify configuration.
    If you use front-matter plugin, then the front matter variables will be available. Here is a demo using front matter:
    https://docsify-mustache.github.io/#/?id=front-matter

  11. stale commented on Apr 4, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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