Shifterはサブディレクトリへの公開をサポートし始めましたが、AWS
S3やNetlifyのような外部サーバーに成果物を公開する場合は、いくつかの作業が必要になります。このドキュメントでは、私たちのスクリプトとその使用方法を紹介します。Netlifyへのサブディレクトリ公開用のWebhookは現在利用可能です。
手順
-
Shifterダッシュボードから成果物をダウンロードする
- 参照: 成果物のダウンロード方法
-
変換スクリプトを入手する
- スクリプトセクションのスクリプトをコピーして、メモ帳に貼り付けて保存します。
-
ダウンロードした成果物に対してスクリプトを実行する
-
変換された成果物をAWS
S3やNetlifyのような外部サーバーに公開する
スクリプト
必要に応じてコピーして保存してください。
“`bash ARTIFACT_ID=YOUR_ARTIFACT_ID tar xvzf
“${ARTIFACT_ID}”.tgz
export SUBDIR=blog export BASE_NAME=example.on.getshifter.io export
NEW_NAME=example.com
find “${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e ‘s@<a(
[^/>])href=“/@<a$1href=”/$ENV{SUBDIR}/@gsi’ {} ; find”${ARTIFACT_ID}” -name
’index.html’ -exec perl -pi -e “s@<a( [^/>])href=’/@<a
1href=′/ENV{SUBDIR}/@gsi” {} ; find “${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e
“s@’/wp-content@/$ENV{SUBDIR}/wp-content@gsi” {} ; find “${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e
“s@’/wp-includes@’/$ENV{SUBDIR}/wp-includes@gsi” {} ; find “${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e
‘s@”/wp-content@”/$ENV{SUBDIR}/wp-content@gsi’ {} ; find”${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e
‘s@”/wp-includes@”/$ENV{SUBDIR}/wp-includes@gsi’ {} ; find “${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e
‘s@s/wp-content@ /$ENV{SUBDIR}/wp-content@gsi’ {} ; find”${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e
‘s@s/wp-includes@ /$ENV{SUBDIR}/wp-includes@gsi’ {} ;
find “${ARTIFACT_ID}” -name ‘index.html’
-exec perl -pi -e
‘s@<linksrel=”amphtml”shref=”https://$ENV{BASE_NAME}/@<link
rel=”amphtml” href=“https://ENVNEWNAME/ENV{SUBDIR}/@gsi’ {} ; find”${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e
“s@<linksrel=’amphtml’shref=’https://$ENV{BASE_NAME}/@<link
rel=‘amphtml’ href=‘https://ENVNEWNAME/ENV{SUBDIR}/@gsi” {} ; find “${ARTIFACT_ID}/*/amp/” -name ‘index.html’ -exec perl
-pi -e
‘s@<linksrel=”canonical”shref=”https://$ENV{BASE_NAME}/@<link
rel=”canonical” href=“https://ENVNEWNAME/ENV{SUBDIR}/@gsi’ {} ; find”${ARTIFACT_ID}/*/amp/” -name ‘index.html’ -exec perl
-pi -e
“s@<linksrel=’canonical’shref=’https://$ENV{BASE_NAME}/@<link
rel=’canonical’ href=’https://ENVNEWNAME/ENV{SUBDIR}/@gsi” {} ;
find “${ARTIFACT_ID}” -name ‘index.html’
-exec perl -pi -e “s@<meta(
[^/>]*)content=’https://$ENV{BASE_NAME}/@<meta 1content=′https : //ENV{NEW_NAME}/$ENV{SUBDIR}/@gsi” {} \;
find “${ARTIFACT_ID}” -name ‘index.html’ -exec perl -pi -e
’s@<meta( [^/>]*)content=“https://$ENV{BASE_NAME}/@<meta $1content=”https://$ENV{NEW_NAME}/$ENV{SUBDIR}/@gsi’ {} ;
perl -pi -e ’s@https://ENVBASENAME@ < link > https : //ENV{NEW_NAME}/$ENV{SUBDIR}@gsi’
“${ARTIFACT_ID}“/feed/index.html perl -pi -e ’s@<atom:link(
[^/>]*)href=“https://$ENV{BASE_NAME}@<atom:link$1href=”https://$ENV{NEW_NAME}/$ENV{SUBDIR}@gsi’
“${ARTIFACT_ID}”/feed/index.html