-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs.raqn.io: adding basic table of content for developers content #34
Conversation
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
|
|
const sitePathPrefix = 'developers'; | ||
|
||
export default class DeveloperToc extends ComponentBase { | ||
ready() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionally for this type of component which needs to be initialized without having a block on the page, there is a feature used for breadcrumbs which could be reused.
This will add the component in the first section on the page based on the bellow selector for targetsSelectors
.
Is it required to have it's own section?
Meta attribute structure-${componentName}
-> structure-developers-toc
set to true
Config required on the DeveloperToc class:
static loaderConfig = {
...ComponentBase.loaderConfig,
targetsSelectors: 'main > div:first-child',
targetsSelectorsLimit: 1,
};
extendConfig() {
return [
...super.extendConfig(),
{
contentFromTargets: false,
addToTargetMethod: 'replaceWith',
targetsAsContainers: {
addToTargetMethod: 'prepend',
contentFromTargets: false,
},
},
];
}
scripts/init.js
Outdated
@@ -93,6 +93,7 @@ export const onLoadComponents = { | |||
], | |||
|
|||
async init() { | |||
await this.setupTemplateAndAutoBlocks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For templates we could still use the web-component to have the same features as a component where we can have different settings by viewport and css file if needed plus the ability to use the config file option.
It could even handle things like the placeholder render/replacement on content outside of blocks.
But this simple approach is also useful where we have just a small change like this and we don't need a full component.
Luckily our component loader can also work with a function if the module exports a default one instead of a class.
WDYT?
We can keep it as is, add the topic for spec/refinement to explore the options.
Basic implementation of a table of content to have an overview of what pages are available generated from GIT markdown.
This can only be tested with a local CORS proxy or directly on docs.raqn.io
unfortunately not working