phartenfeller / gatsby-philipps-foam-theme

Foam theme for Gatsby
https://phartenfeller.github.io/gatsby-philipps-foam-theme/
Other
18 stars 2 forks source link

How to avoid building pages inside a specific folder #5

Closed t2hv33 closed 3 years ago

t2hv33 commented 3 years ago

Hi @phartenfeller As a user, I don't want to publish private notes Foam inside a specific folder. My structure folders tree

|--_layouts
|--docs
|--private #don't want to publish this folder
|--notes

I have a lot of folders same level with docs After run yarn develop gatsby also renders all private notes on the public folder. My expectation here is: private folders do not render. How to do that? Is there a way to avoid building pages with certain paths in Gatsby? Thanks,

phartenfeller commented 3 years ago

Hi!

There is already an option for it that wasn't documented (till now 😄).

You can add an ignore array to your config and add your "private" folder:

   plugins: [
    {
      resolve: `gatsby-philipps-foam-theme`,
      options: {
        rootNote: "/readme",
        contentPath: "/",
        ignore: [
          "**/private/**",
        ],
      },
    },
   ],

Links to private pages for now result in a 404. I may remove the HTML a tag and make it outstanding that the link won't work in the future.

t2hv33 commented 3 years ago

Hi @phartenfeller It's working like a charm when I use "**/private/**/*", all notes inside displayed 404, can't search. "**/private/**": Pages inside private can search

phartenfeller commented 3 years ago

Thanks for the info, I changed the readme!

I created #6 to track removing links to excluded pages.

Regards, Philipp