Open julienvincent opened 5 years ago
After a bit of digging I have found that I can achieve what I want through the App Level Enhancements API. For example:
// enhanceApp.js
export default ({ Vue, options, router, siteData }) => {
siteData.themeConfig.algolia.transformData = suggestions => {
return suggestions.map(function(suggestion) {
// ...
});
};
};
This was a rather obscure to figure out and I only really clicked that siteData contained my config after reading the source-code and seeing this name being used elsewhere (i.e @internal/siteData
).
I think something can still be done here to make it a bit clearer for other people on how to do these kinda things. Perhaps an FAQ section on adding functions to config?
If we use our own algolia search index (different appId), is there a docs for vuepress on which data is required to be generated for search to work?
Feature request
I would like to be able to provide hooks to the DocSearch client for controlling input/output of the algolia search. Currently all functions are stripped out of the config given to the web-app, preventing me from being able to properly use the DocSearch client.
What problem does this feature solve?
Better integration with DocSearch.
For my specific case my docs are internal and need to be scraped from
localhost
. This means all search results contain thelocalhost
hostname and I need to use thetransformData
DocSearch hook to rewrite the base hostname.What does the proposed API look like?
How should this be implemented in your opinion?
The config given to the client through
@internal/siteData
must not have functions stripped outAre you willing to work on this yourself?**
Yes, I started looking into this but for the life of me cannot figure out the build chain. I would be more than happy to implement this but would need some assistance in figuring out how the
@internal
files are populated.