vendredi 19 mars 2021

Attempting to exclude specific files from metalsmith-simple-search

I'm attempting to exclude 2 specific pages from metalsmith-simple-search using the match property. example:

.use(simpleSearch({
    "destinationJs": "./assets/js/simple-search.min.js",
    "destinationJson": "./assets/js/search.json",
    "index": {
        "title": true,
        "keywords": true,
        "description": true,
        "contents": "html"
    },
    //"match": "**/*.{htm,html}",
    "match": "!(error-404|search)**/*.{htm,html}", 
    "matchOptions": {},
    "skipSearchJs": false
}))

The default "**/*.{htm,html}" matches every page on the site, but I don't want to include the custom 404 page or the search page itself.

// example file directory
index.html                               // homepage should include
error-404/index.html                     // exclude  
our-services/index.html                  // include
our-services/bussiness/index.html        // include
search/index.html                        // exclude

My modified "!(error-404|search)**/*.{htm,html}" removes both unwanted pages, but also removes the homepage of the site. All my attempts to restore the homepage, without also adding back error-404 and search have failed.

Is anyone out there familiar enough with how patterns are matched here to help me out?

Aucun commentaire:

Enregistrer un commentaire