mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 01:35:56 +01:00
Fix import task
This commit is contained in:
parent
d477c7177e
commit
92ced80c60
5 changed files with 16 additions and 5 deletions
|
@ -24,5 +24,7 @@ tasks:
|
|||
- hugo --cacheDir /tmp/hugo/cache --gc --minify --baseURL "${DOMAIN}"
|
||||
- npm_config_yes=true npx pagefind@latest
|
||||
import:
|
||||
cmds:
|
||||
- cd ./tools/import/omnivore && go run .
|
||||
dir: tools/
|
||||
cmds:
|
||||
- go run ./import/omnivore ../
|
||||
- go run ./import/webmentionio
|
||||
|
|
1
data/interactions/notes/twitter/5653892614.json
Normal file
1
data/interactions/notes/twitter/5653892614.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"interactions":[{"guid":"webmentions.io#1799435","emoji":"⭐️","url":"https://hachyderm.io/@byjp/112183980587832116#favorited-by-112139367222387976","author":{"name":"shellsharks","url":"https://shellsharks.social/@shellsharks"},"timestamp":"2024-03-30T12:41:28Z"},{"guid":"webmentions.io#1799436","emoji":"💬","url":"https://hachyderm.io/@byjp/112183987371889835","comment":"Perhaps, now my generation lives in a world where more of us can connect with the informality and emotion of our younger selves, we’ll see these digital generations have more empathy for the generations after us than has been easy for those that went before us?","author":{"name":"JP","url":"https://hachyderm.io/@byjp"},"timestamp":"2024-03-30T09:43:19Z"}]}
|
|
@ -15,6 +15,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
|
@ -28,6 +29,11 @@ var ignoreLabels = []string{
|
|||
}
|
||||
|
||||
func main() {
|
||||
if err := godotenv.Load(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
apiKey, ok := os.LookupEnv("OMNIVORE_API_KEY")
|
||||
if !ok || len(apiKey) == 0 {
|
||||
fmt.Fprint(os.Stderr, "OMNIVORE_API_KEY is not set")
|
||||
|
@ -42,8 +48,9 @@ func main() {
|
|||
outputDir := path.Join(rootDir, "content/bookmarks")
|
||||
if !isDir(outputDir) {
|
||||
fmt.Printf(
|
||||
"Usage: %s [directory]\n 'directory' should be the root of your hugo blog (default: ./)\n",
|
||||
"Usage: %s [directory]\n [directory] should be the root of your hugo blog (current: %s)\n",
|
||||
path.Base(os.Args[0]),
|
||||
rootDir,
|
||||
)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -91,7 +98,9 @@ func outputArticle(article Article, outputDir string) error {
|
|||
fm.Date = article.BookmarkDate.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
fm.Title = article.Title
|
||||
if len(fm.Title) == 0 {
|
||||
fm.Title = article.Title
|
||||
}
|
||||
fm.BookmarkOf = article.OriginalURL
|
||||
fm.Tags = removeDupes(append(fm.Tags, article.Tags...))
|
||||
|
||||
|
|
1
tools/import/webmentionio/.gitignore
vendored
1
tools/import/webmentionio/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
.env
|
Loading…
Reference in a new issue