Import: only content you own or have the rights to use #11

Merged
jcoffey-dev merged 1 commits from import/your-own-content into main 2026-10-12 00:27:11 +00:00
4 changed files with 18 additions and 2 deletions

No files matched your search

+3 -2
View File
@@ -46,7 +46,7 @@ Usage:
hotdog-cms ci <platform> write the CI file for github, gitea, forgejo, gitlab, bitbucket, woodpecker, or a git hook
hotdog-cms endpoint -config FILE the small server for form submissions and search, behind your web server
hotdog-cms pack add|remove|list|check extensions as files: sections, layouts, styles (docs/packs.md)
hotdog-cms import <from> ... bring a site in: wordpress, wxr, ghost, hugo or jekyll (docs/importing.md)
hotdog-cms import <from> ... move your own site in: wordpress, wxr, ghost, hugo or jekyll (docs/importing.md)
hotdog-cms editor -config FILE the editor: sign in with your git platform and work on sites (never on a site's host)
Platforms: GitHub, GitLab, Gitea, Forgejo/Codeberg, Gogs, Bitbucket, or any git server.
@@ -492,7 +492,7 @@ func report(r *build.Result) {
func cmdImport(args []string) error {
if len(args) == 0 {
return errors.New("usage: hotdog-cms import <wordpress|wxr|ghost|hugo|jekyll> [flags] (hotdog-cms import <from> -h for each)")
return errors.New("usage: hotdog-cms import <wordpress|wxr|ghost|hugo|jekyll> [flags] (hotdog-cms import <from> -h for each)\n" + importer.Ownership)
}
from, args := args[0], args[1:]
fl := flag.NewFlagSet("import "+from, flag.ExitOnError)
@@ -519,6 +519,7 @@ func cmdImport(args []string) error {
return fmt.Errorf("can't import from %q: wordpress, wxr, ghost, hugo or jekyll", from)
}
_ = fl.Parse(args)
fmt.Printf("%s\n\n", importer.Ownership)
var items []importer.Item
var err error
opt := importer.Options{SiteDir: *siteDir, Overwrite: *overwrite, Log: os.Stdout}
+5
View File
@@ -1,5 +1,10 @@
# Importing a site
> **Only import content you own or have the rights to use.** The importers
> are migration tools: they're for moving *your own* site to HotDog CMS from
> the tool it's on now. They're not for copying sites, posts or pictures that
> belong to someone else, and they say so every time they run.
`hotdog-cms import` brings a site in from WordPress, Hugo, Jekyll or Ghost,
into a HotDog CMS site made with `hotdog-cms new`:
+3
View File
@@ -153,6 +153,9 @@ func TestWordPressImport(t *testing.T) {
if ck.Errors() > 0 {
t.Errorf("check errors: %v", ck.Problems)
}
if md := rep.Markdown(srv.URL); !strings.Contains(md, "> "+Ownership) {
t.Errorf("the report doesn't open with the ownership note:\n%s", md)
}
if md := rep.Markdown(srv.URL); !strings.Contains(md, "with-video.md`: ") || !strings.Contains(md, "an embed") {
t.Errorf("report:\n%s", md)
}
+7
View File
@@ -475,9 +475,16 @@ func fetch(u, localRoot string) ([]byte, error) {
}
// WriteReport writes what happened as Markdown, for the person who ran it.
// Ownership is said before every import and at the top of every report:
// the importers are for moving your own site, not for copying anyone else's.
const Ownership = "Import only content you own or have the rights to use. " +
"hotdog-cms import is a migration tool, for moving your own site to HotDog CMS, " +
"not for copying sites, posts or pictures that belong to someone else."
func (r *Report) Markdown(source string) string {
var b strings.Builder
fmt.Fprintf(&b, "# Import from %s\n\n", source)
fmt.Fprintf(&b, "> %s\n\n", Ownership)
fmt.Fprintf(&b, "%d page(s) written, %d skipped (already there), %d picture(s) brought in, %d redirect(s) added.\n\n", len(r.Written), len(r.Skipped), r.Pictures, len(r.Redirects))
if len(r.KeptHTML) > 0 {
b.WriteString("## Kept as HTML\n\nMarkdown would have lost something in these, so their HTML was kept (`format: html`). It's sanitized when the site is built, so embeds and scripts are dropped; check how they look.\n\n")