Skip to content

Commit

Permalink
fix seo issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavarri committed Sep 18, 2023
1 parent dce690b commit 2c746ab
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/how-to-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Let's go through them in detail:
### Add an `opam` file

To migrate your ReScript library to Melange, you will need some packages.
Melange is designed to be used with [opam](opam.ocaml.org/), the package manager
Melange is designed to be used with [opam](https://opam.ocaml.org/), the package manager
of OCaml, which is explained in [its own section](./package-management.md).

To get started with the library migration, let's create an `opam` file in your
Expand Down
15 changes: 11 additions & 4 deletions scripts/add_canonical.ml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ let to_v2_paths input =
|> global_replace (regexp_string "Js/Weakset") "Js/WeakSet"
|> global_replace (regexp_string "Js/Weakmap") "Js/WeakMap"
|> global_replace (regexp_string "Js/Typed_array2") "Js/TypedArray2"
|> global_replace (regexp_string "Js/Parser") "Js_parser"

let relative_path base_path target_path =
let base_parts = split (regexp_string Filename.dir_sep) base_path in
Expand All @@ -80,10 +81,16 @@ let relative_path base_path target_path =
String.concat Filename.dir_sep (parent_dirs @ remaining)

let can_ignore file_path =
contains_substring ~sub:"Melange_ppx/Ast_literal" file_path
|| contains_substring ~sub:"Melange_ppx/Private/Typemod_hide" file_path
|| contains_substring ~sub:"Melange_ppx/Derivers" file_path
|| contains_substring ~sub:"Melange_ppx/Mapper" file_path
contains_substring ~sub:"melange/Caml/" file_path
|| contains_substring ~sub:"melange/Caml_" file_path
|| contains_substring ~sub:"melange/Js_OO" file_path
|| contains_substring ~sub:"melange/Js_cast" file_path
|| contains_substring ~sub:"melange/Parsing0" file_path
|| contains_substring ~sub:"melange/Belt_internal" file_path
|| contains_substring ~sub:"melange/Ast_signature" file_path
|| contains_substring ~sub:"melange/Melange_ppx_lib" file_path
|| contains_substring ~sub:"melange/Melange_ppxlib_ast" file_path
|| contains_substring ~sub:"melange/Node_fs/Node" file_path

let replace_in_file ~orig_path file_path search_str =
let ic = open_in file_path in
Expand Down
48 changes: 48 additions & 0 deletions scripts/add_canonical.t
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,36 @@ Test add_canonical exe
> <head></head>
> EOF

$ mkdir -p melange/Caml
$ cat > ./melange/Caml/index.html <<EOF
> <head></head>
> EOF

$ mkdir -p melange/Caml_format
$ cat > ./melange/Caml_format/index.html <<EOF
> <head></head>
> EOF

$ mkdir -p melange/Js_parser/Declaration_parser
$ cat > ./melange/Js_parser/Declaration_parser/index.html <<EOF
> <head></head>
> EOF

$ mkdir -p melange/Belt_internalSetBuckets
$ cat > ./melange/Belt_internalSetBuckets/index.html <<EOF
> <head></head>
> EOF

$ mkdir -p melange/Js_OO
$ cat > ./melange/Js_OO/index.html <<EOF
> <head></head>
> EOF

$ mkdir -p melange/Js_cast
$ cat > ./melange/Js_cast/index.html <<EOF
> <head></head>
> EOF

$ add_canonical .

$ cat ./melange/Js_global/index.html
Expand Down Expand Up @@ -123,3 +153,21 @@ Test add_canonical exe

$ cat ./melange/Melange_ppx/External/index.html
<head><link rel="canonical" href="https://melange.re/v2.0.0/api/melange/Melange_ppx/External/index.html" /></head>

$ cat ./melange/Caml/index.html
<head></head>

$ cat ./melange/Caml_format/index.html
<head></head>

$ cat ./melange/Js_parser/Declaration_parser/index.html
<head><link rel="canonical" href="https://melange.re/v2.0.0/api/melange/Js_parser/Declaration_parser/index.html" /></head>

$ cat ./melange/Belt_internalSetBuckets/index.html
<head></head>

$ cat ./melange/Js_OO/index.html
<head></head>

$ cat ./melange/Js_cast/index.html
<head></head>

0 comments on commit 2c746ab

Please sign in to comment.