-
Notifications
You must be signed in to change notification settings - Fork 0
Model site archetypes in Front Matter CMS and ease article submission #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
08daed8
Model site archetypes in Front Matter CMS and ease article submission
HeyItsGilbert 79ada3a
feat(vscode): ✨ add recommended extensions for Front Matter CMS
HeyItsGilbert 92ef813
chore: ✨ add .netlify to .gitignore
HeyItsGilbert 69c7679
Fix for trailing comma
KennyNeal 5ed81be
Address PR review feedback on archetypes setup
HeyItsGilbert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| {} |
This file contains hidden or 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,92 @@ | ||
| { | ||
| "taxonomy": { | ||
| "tags": [], | ||
| "categories": [ | ||
| "Announcements", | ||
| "Books", | ||
| "DevOps", | ||
| "Events", | ||
| "Graph", | ||
| "In Case You Missed It", | ||
| "News", | ||
| "PowerShell Summit", | ||
| "PowerShell for Admins", | ||
| "PowerShell for Developers", | ||
| "Scripting Games", | ||
| "Tips and Tricks", | ||
| "Tools", | ||
| "Training", | ||
| "Tutorials" | ||
| ] | ||
| }, | ||
| "customTaxonomy": [ | ||
| { | ||
| "id": "authors", | ||
| "options": [ | ||
| "Aaron Jensen", | ||
| "Adam Bertram", | ||
| "Adam Platt", | ||
| "Alex Aymonier", | ||
| "Art Beane", | ||
| "Bartek Bielawski", | ||
| "Bjorn Houben", | ||
| "Boe Prox", | ||
| "Brian Bourque", | ||
| "Carlo Mancini", | ||
| "Chris Martin", | ||
| "Cole McDonald", | ||
| "Colyn Via", | ||
| "Darren Mar-Elia", | ||
| "David Jones", | ||
| "David Wilson", | ||
| "Don Jones", | ||
| "Eli Hess", | ||
| "Enrique Puig", | ||
| "Eric Brookman (scriptingcaveman)", | ||
| "Glenn Sizemore", | ||
| "Graham Beer", | ||
| "Greg Altman", | ||
| "Greg Tate", | ||
| "Jaap Brasser", | ||
| "Jacob Benson", | ||
| "Jacob Moran", | ||
| "James Petty", | ||
| "Jeffery Hicks", | ||
| "Joel Newton", | ||
| "John Mello", | ||
| "Jonas Sommer Nielsen", | ||
| "Jonathan Medd", | ||
| "Jonathan Walz", | ||
| "June Blender", | ||
| "Keith Hill", | ||
| "Kirk Munro", | ||
| "Liam Kemp", | ||
| "Mark Kraus (markekraus)", | ||
| "Mark Roloff", | ||
| "Mark Wragg", | ||
| "Matt Laird", | ||
| "Matthew Hodgkins", | ||
| "Mike F Robbins", | ||
| "Mike Kanakos", | ||
| "Mike Roberts", | ||
| "Missy Januszko", | ||
| "Nathaniel Webb (ArtisanByteCrafter)", | ||
| "Nick Rimmer", | ||
| "Richard Siddaway", | ||
| "Robin Dadswell", | ||
| "Stephen Moore", | ||
| "Stephen Owen", | ||
| "Steve Parankewich", | ||
| "Steven Murawski", | ||
| "Sunny Chakraborty", | ||
| "Terri Donahue", | ||
| "Thomas Malkewitz", | ||
| "Thomas Rayner, MVP", | ||
| "Tim Curwick", | ||
| "Timothy Warner", | ||
| "WeiYen Tan", | ||
| "Will Anderson" | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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
This file contains hidden or 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,128 @@ | ||
| name: Add Guest Article | ||
|
|
||
| on: | ||
| issues: | ||
| types: [labeled] | ||
|
|
||
| jobs: | ||
| add-article: | ||
| if: | | ||
| github.event.label.name == 'approved' && | ||
| contains(github.event.issue.labels.*.name, 'article') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Parse issue and create article content file | ||
| id: parse | ||
| env: | ||
| ISSUE_BODY: ${{ github.event.issue.body }} | ||
| ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
| ISSUE_TITLE: ${{ github.event.issue.title }} | ||
| run: | | ||
| python3 - <<'PYEOF' | ||
| import os, re, datetime, yaml | ||
|
|
||
| # Normalize line endings — issue bodies can contain CRLF. | ||
| body = os.environ['ISSUE_BODY'].replace('\r\n', '\n').replace('\r', '\n') | ||
|
|
||
| def strip_html(s): | ||
| # Strip raw HTML from scalar front matter values (matches add-event.yml). | ||
| return re.sub(r'<[^>]+>', '', s).strip() | ||
|
|
||
| def field(label): | ||
| m = re.search(rf'### {re.escape(label)}\s+(.+?)(?=\n###|\Z)', body, re.DOTALL) | ||
| if not m: | ||
| return '' | ||
| val = m.group(1).strip() | ||
| return '' if val in ('_No response_', '') else val | ||
|
|
||
| title = strip_html(field('Article Title')) | ||
| author = strip_html(field('Author Name')) | ||
| description = strip_html(field('Description')) | ||
| category = strip_html(field('Category')) | ||
| tags_raw = strip_html(field('Tags (optional)')) | ||
| content = field('Article Content (Markdown)') | ||
|
|
||
| # The Article Content field is rendered as a ```markdown fenced block — unwrap it, | ||
| # tolerating surrounding whitespace/blank lines around the fences. | ||
| content = re.sub(r'^\s*```[a-zA-Z]*[ \t]*\n', '', content) | ||
| content = re.sub(r'\n```[ \t]*\s*$', '', content).strip() | ||
|
|
||
| if not title: | ||
| raise SystemExit('No article title found; aborting.') | ||
| if not content: | ||
| # A pitch with no draft — nothing to publish yet. | ||
| print('No article content provided (pitch only); skipping file creation.') | ||
| with open(os.environ['GITHUB_OUTPUT'], 'a') as out: | ||
| out.write('skip=true\n') | ||
| raise SystemExit(0) | ||
|
|
||
| tags = [t.strip() for t in re.split(r'[,\n]', tags_raw) if t.strip()] | ||
|
|
||
| today = datetime.datetime.now(datetime.timezone.utc) | ||
| date_str = today.strftime('%Y-%m-%dT%H:%M:%S+00:00') | ||
|
|
||
| slug = re.sub(r'[^a-z0-9]+', '-', title.lower()).strip('-') | ||
| if not slug: | ||
| # Title was only punctuation / non-ASCII — fall back to the issue number. | ||
| slug = f"article-{os.environ['ISSUE_NUMBER']}" | ||
| filename = f"{today.strftime('%Y-%m-%d')}-{slug}.md" | ||
|
|
||
| fm = { | ||
| 'title': title, | ||
| 'author': author, | ||
| 'authors': [author] if author else [], | ||
| 'date': date_str, | ||
| 'description': description, | ||
| } | ||
| if category: | ||
| fm['categories'] = [category] | ||
| if tags: | ||
| fm['tags'] = tags | ||
|
|
||
| front = yaml.safe_dump(fm, default_flow_style=False, allow_unicode=True, sort_keys=False) | ||
| document = '---\n' + front + '---\n\n' + content + '\n' | ||
|
|
||
| filepath = f'content/articles/{filename}' | ||
| os.makedirs('content/articles', exist_ok=True) | ||
| with open(filepath, 'w', encoding='utf-8') as f: | ||
| f.write(document) | ||
|
|
||
| with open(os.environ['GITHUB_OUTPUT'], 'a') as out: | ||
| out.write(f'skip=false\n') | ||
| out.write(f'slug={slug}\n') | ||
| out.write(f'filepath={filepath}\n') | ||
| out.write(f'article_title={title}\n') | ||
|
|
||
| print(f'Created {filepath}') | ||
| PYEOF | ||
|
|
||
| - name: Open PR | ||
| if: steps.parse.outputs.skip == 'false' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| SLUG: ${{ steps.parse.outputs.slug }} | ||
| FILEPATH: ${{ steps.parse.outputs.filepath }} | ||
| ARTICLE_TITLE: ${{ steps.parse.outputs.article_title }} | ||
| ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
| run: | | ||
| BRANCH="article/issue-${ISSUE_NUMBER}-${SLUG}" | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git checkout -b "$BRANCH" | ||
| git add "$FILEPATH" | ||
| git commit -m "Add article: ${ARTICLE_TITLE} (closes #${ISSUE_NUMBER})" | ||
| git push origin "$BRANCH" | ||
| gh pr create \ | ||
| --title "Add article: ${ARTICLE_TITLE}" \ | ||
| --body "Closes #${ISSUE_NUMBER} | ||
|
|
||
| Auto-generated from guest blog post submission. Please review front matter and content before merging." \ | ||
| --base main \ | ||
| --head "$BRANCH" |
This file contains hidden or 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 +1,4 @@ | ||
| public/ | ||
|
|
||
| # Local Netlify folder | ||
| .netlify |
This file contains hidden or 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,7 @@ | ||
| { | ||
| "recommendations": [ | ||
| "eliostruyf.vscode-front-matter", | ||
| "davidanson.vscode-markdownlint", | ||
| "yzhang.markdown-all-in-one" | ||
| ] | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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,11 @@ | ||
| --- | ||
| title: '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
| description: "" | ||
| author: "" | ||
| authors: | ||
| - "" | ||
| date: '{{ .Date }}' | ||
| categories: [] | ||
| tags: [] | ||
| draft: true | ||
| --- |
This file contains hidden or 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,8 @@ | ||
| --- | ||
| title: '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
| description: "" | ||
| layout: "authors" | ||
| website: "" | ||
| twitter: "" | ||
| github: "" | ||
| --- |
This file contains hidden or 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,8 @@ | ||
| --- | ||
| title: '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
| startDate: '{{ .Date | dateFormat "2006-01-02" }}' | ||
| endDate: "" | ||
| where: "" | ||
| externalUrl: "" | ||
| virtual: false | ||
| --- |
This file contains hidden or 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,5 +1,5 @@ | ||
| +++ | ||
| date = '{{ .Date }}' | ||
| draft = true | ||
| title = '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
| +++ | ||
| --- | ||
| title: '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
| date: '{{ .Date }}' | ||
| draft: true | ||
| --- |
This file contains hidden or 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,10 @@ | ||
| --- | ||
| title: '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
| description: "" | ||
| author: "" | ||
| authors: | ||
| - "" | ||
| date: '{{ .Date }}' | ||
| podcast_url: "" | ||
| draft: true | ||
| --- |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.