Skip to content

Instantly share code, notes, and snippets.

@rey
Created September 17, 2023 15:33
Show Gist options
  • Select an option

  • Save rey/c261c6afbd2775504eef27103d2122ff to your computer and use it in GitHub Desktop.

Select an option

Save rey/c261c6afbd2775504eef27103d2122ff to your computer and use it in GitHub Desktop.

Revisions

  1. rey created this gist Sep 17, 2023.
    25 changes: 25 additions & 0 deletions archive.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    #!/bin/bash

    # yq:
    # snap install yq
    # waybackpy:
    # pip3 install waybackpy

    file="${1}"

    post_layout=$(yq --front-matter=extract '.layout' ${file})

    if [[ "${post_layout}" == "link" ]]; then

    echo "This looks link a link post!"

    post_link=$(yq --front-matter=extract '.link' ${file})

    waybackpy --url "${post_link}" --save

    else

    echo "This post is not a link post!"

    fi