kopia lustrzana https://github.com/shoelace-style/shoelace
cleanup /index.html from search results
rodzic
414197acc9
commit
8cf1171a65
docs
assets/scripts
|
@ -284,7 +284,7 @@
|
|||
const a = document.createElement('a');
|
||||
const displayTitle = page.title ?? '';
|
||||
const displayDescription = page.description ?? '';
|
||||
const displayUrl = page.url.replace(/^\//, '');
|
||||
const displayUrl = page.url.replace(/^\//, '').replace(/\/$/, '');
|
||||
let icon = 'file-text';
|
||||
|
||||
a.setAttribute('role', 'option');
|
||||
|
|
|
@ -171,7 +171,10 @@ module.exports = function (eleventyConfig) {
|
|||
this.field('c'); // content
|
||||
|
||||
results.forEach((result, index) => {
|
||||
const url = path.join('/', path.relative(eleventyConfig.dir.output, result.outputPath)).replace(/\\/g, '/');
|
||||
const url = path
|
||||
.join('/', path.relative(eleventyConfig.dir.output, result.outputPath))
|
||||
.replace(/\\/g, '/') // convert backslashes to forward slashes
|
||||
.replace(/\/index.html$/, '/'); // convert trailing /index.html to /
|
||||
const doc = new JSDOM(result.content, {
|
||||
// We must set a default URL so links are parsed with a hostname. Let's use a bogus TLD so we can easily
|
||||
// identify which ones are internal and which ones are external.
|
||||
|
|
Ładowanie…
Reference in New Issue