-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Netlify Build plugin to generate metadata normally provided by gi…
…thub-metadata gem
- Loading branch information
Showing
5 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,3 +85,4 @@ exclude: | |
- webpack.config.js | ||
- README.md | ||
- LICENSE | ||
- netlify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[build] | ||
command = "jekyll build" | ||
command = "jekyll build --config _config.yml,_config_override.yml" | ||
publish = "_site" | ||
|
||
[[plugins]] | ||
package = "/netlify/plugins/netlify-jekyll-metadata" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import fs from 'node:fs' | ||
import url from 'node:url' | ||
|
||
export const onPreBuild = async function () { | ||
const siteUrl = process.env.URL | ||
const repoUrl = new URL(process.env.REPOSITORY_URL || '') | ||
const repoNameWithOwner = repoUrl.pathname.replace(/^\/+/, '') | ||
|
||
const fileName = '_config_override.yml' | ||
const fileContents = `repository: ${repoNameWithOwner}\nurl: ${siteUrl}` | ||
return fs.promises.writeFile(fileName, fileContents) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: netlify-jekyll-metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "netlify-jekyll-metadata", | ||
"description": "Netlify Build Plugin to populate a Jekyll site with the metadata normally provided by the github-metadata gem", | ||
"type": "module", | ||
"exports": "./index.js" | ||
} |