Skip to content

Commit

Permalink
Fix: change path to src/content to match astro v2 conent collections
Browse files Browse the repository at this point in the history
  • Loading branch information
onadrog committed Jan 30, 2023
1 parent 9e68134 commit 8816a85
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Create page with auto generated frontmatter.
### Usage

Make sure you run the command inside the root directory of your site projet.
It will create a file in the src/pages path.
It will create a file in the src/content path.

```bash
# $ astroadd [path]
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var rootCmd = &cobra.Command{
Use: "astroadd [path]",
Short: "Create a new file",
Long: `Create a new file.
Goes to src/pages
Goes to src/content
Based on the given path.
Automatically add the frontmatter (title, date, draft).
Ensure you run this within the root directory of your site.`,
Expand Down
2 changes: 1 addition & 1 deletion helpers/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// Get the os platform separator
var sep = os.PathSeparator
var basePath = fmt.Sprintf("src%cpages%c", sep, sep)
var basePath = fmt.Sprintf("src%ccontent%c", sep, sep)

// Return the title without dashes and the directory path for the given path.
// Or an error
Expand Down
12 changes: 6 additions & 6 deletions helpers/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ func TestSanitizer(t *testing.T) {
arg string
expected string
}{
{"pages/posts.md", "Posts"},
{"pages/posts-1.md", "Posts 1"},
{"pages/posts_2.md", "Posts 2"},
{"pages/[email protected]", "Posts 3"},
{"pages/[email protected]", "Posts blog 4"},
{"pages/posts_blog@/4.md", "4"},
{"content/posts.md", "Posts"},
{"content/posts-1.md", "Posts 1"},
{"content/posts_2.md", "Posts 2"},
{"content/[email protected]", "Posts 3"},
{"content/[email protected]", "Posts blog 4"},
{"content/posts_blog@/4.md", "4"},
}

for _, tc := range cases {
Expand Down

0 comments on commit 8816a85

Please sign in to comment.