I want to place a Last updated: ${window.$docsify.lastUpdated} text after the article content, but before the pagination block. I cannot do this with either the hook.beforeEach of hook.afterEach plugin method - how can I achieve this?
try keeping the pagination plugin at the last script and use beforeEach and add the markdown for that. pagination plugin is using afterEach hook i think
If I use beforeEach, I get:
Last updated: undefined
I'm guessing that beforeEach doesn't have access to the window object (?)
try using vm. instead of windows. I don't remember the exact object name and its properties. Need to look there. Check the docsify object inside the vm if present.
Weirdly, I can see vm.config.lastUpdated in the vm object, but when I console.log it, it is undefined !
vm.config is from the config object of docsify
I can suggest a solution (hacky)
you can set the lastUpdate manually using js in your HTML
or in beforeEach hook you place a placeholder something like __lastUpdate__ and in afterEach you do regex and replace it with the lastUpdate property as it wont be undefined at that time.
Its more like a templating
ok, I'll try this, but is there going to be an opportunity down the line to be able to append to the article without a hacky approach?
ok, I'll try this, but is there going to be an opportunity down the line to be able to append to the article without a hacky approach?
it depends on how other plugins are written and how they are being used.
if you are using a pagination plugin after your plugin, it shouldn't be an issue then.
its like a waterfall approach
The hack worked.
any reason to re-open this ?
ok, it didn't quite work :(. But I'm just trying to figure out what the correct way to format sidebar content is before I post a reply because lastupdated text is appearing correctly on some pages and not on others.
Do you have any guidelines on formatting sidebar content and also whether markdown files should go into folders, which one should be named index.md, etc.? These all seem to affect how the sidebar interprets the navigation. Is the purpose of the sidebar to only navigate the content of the page itself?
I would recommend you checking the docsify's docs folder and also this https://github.com/posthtml/posthtml.org.
Problem is that none of these examples have nested folders in their docs with sidebar files in each folder.
Would be good just to understand what the purpose of the sidebar is - it is to navigate just what's on the page, or to navigate the whole site?
just on the page + other pages present in the docs (by manually adding content in _sidebar.md)
may be for page's content. You need to check it manually like with console.logs/debugger
In the first example above, the

Whereas, in the second example above, the

I think it might be cause of page content
Ah, I added a newline to the end of the 'web/index.md' page and it now works. Is it a requirement of markdown files to have a newline at the end?
Is it a requirement of markdown files to have a newline at the end?
I dont know, we are using markedjs to parsing and rendering markdown, so I guess you can ask this question in their repo as well are simply showing what's coming as an output of markedjs.
Or, you could add a auto-add a newline before appending using the hook.beforeEach method.
Or, you could add a auto-add a newline before appending using the
hook.beforeEachmethod.
yes. with plugin's hook you can. It depends on the different use cases so it is something which should be done by plugins
It looks like you got a workaround working for you. I am closing this issue. Please comment if you need some more clarification 馃憤