fix: build script assets

This commit is contained in:
Matthieu Bessat 2022-07-14 18:40:38 +02:00
parent 6592b70aef
commit eef1067e3b
2 changed files with 20 additions and 10 deletions

View file

@ -31,18 +31,29 @@ for locale in "${locales[@]}"; do
# for each file other than index.html, put a proper link back to the main page # for each file other than index.html, put a proper link back to the main page
find ./ -not -name "index.html" -name "*.html" -exec sed -E -i "s/\"(\.\.\/)?$locale\.html/\"\1index.html/g" {} \+ find ./ -not -name "index.html" -name "*.html" -exec sed -E -i "s/\"(\.\.\/)?$locale\.html/\"\1index.html/g" {} \+
# repair the links of the footer locale switcher
# for each line with data-lang-switch="{locale}" replace the href with the link to /{locale}/path...
# attempt to do with pipe failed, so I use a non optimal for loop
# find ./ -name "*.html" -exec sh -c 'sed -E -i "s/data-lang-switch=\"([a-z]{2})\".+href\=\".*\"/href\=\"\/\1\/{}\"/g" {}' \;
for path in $(find ./ -name "*.html"); do
pathM=`echo $path | cut -c 3-`
sed -E -i "s%data-lang-switch=\"([a-z]{2})\".+href\=\".*\"%href\=\"/\1/$pathM\"%g" $path
done
cd .. cd ..
done done
# repair the links of the footer locale switcher
# for each line with data-lang-switch="{locale}" replace the href with the link to /{locale}/path...
# attempt to do with pipe failed, so I use a non optimal for loop
# find ./ -name "*.html" -exec sh -c 'sed -E -i "s/data-lang-switch=\"([a-z]{2})\".+href\=\".*\"/href\=\"\/\1\/{}\"/g" {}' \;
for path in $(find ./ -name "*.html"); do
pathM=`echo $path | cut -c 6-`
sed -E -i "s%data-lang-switch=\"([a-z]{2})\".+href\=\".*\"%href\=\"/\1/$pathM\"%g" $path
done
# remove assets
rm -r *.woff dist imgs
find ./ -name '*.orig' -delete
# change the path of all assets
find ./ -name "*.html" -exec sed -E -i "s%\"\.\./dist/%\"/dist/%g; s%\"dist/%\"/dist/%g; s%\"\.\./imgs/%\"/imgs/%g; s%\"imgs/%\"/imgs/%g" {} \+
cp -r ../public/* ./
rm index.php
kill $phpPID kill $phpPID

View file

@ -13,8 +13,7 @@
<meta property=og:type content="website"> <meta property=og:type content="website">
<meta property=og:title content="{{ block('title') }}{{ getLocalizedStr('page.title') }}"> <meta property=og:title content="{{ block('title') }}{{ getLocalizedStr('page.title') }}">
<meta property=og:description content="{% block description %}{% endblock %}"> <meta property=og:description content="{% block description %}{% endblock %}">
<meta property=og:image content="/img/lefuturiste.jpg"> <meta property=og:image content="/imgs/profile-300.jpg">
<meta property=og:url content="https://lefuturiste.fr/{{ current_url() }}">
<meta property=og:locale content="{{ getLocale() }}"> <meta property=og:locale content="{{ getLocale() }}">
<title>{% block title %}{% endblock %}{{ getLocalizedStr('page.title') }}</title> <title>{% block title %}{% endblock %}{{ getLocalizedStr('page.title') }}</title>