adding new script for new posts (half completed)
parent
6b693ed2d1
commit
0c83807dd1
@ -1,8 +1,35 @@
|
|||||||
nvim -c '39' -c 'norm yypk14w' sitemap/index.html
|
#!/bin/sh
|
||||||
nvim -c '3' -c 'norm yypk10w' blog/index.html
|
|
||||||
nvim -c '3' -c 'norm yypk10w' blog/linux/index.html
|
# Script for new posts
|
||||||
nvim -c '3' -c 'norm yypk10w' blog/software/index.html
|
|
||||||
nvim -c '3' -c 'norm yypk10w' blog/technology/index.html
|
FILE=/tmp/sufyaan-website-post$(date +%d).md
|
||||||
nvim -c '3' -c 'norm yypk10w' blog/design/index.html
|
|
||||||
nvim -c '3' -c 'norm yypk10w' blog/guides/index.html
|
echo '- [ ] Linux\n- [ ] Software\n- [ ] Technology\n- [ ] Design\n- [ ] Guides\n- [ ] Literary\n- [ ] Other' > $FILE
|
||||||
nvim -c '3' -c 'norm yypk10w' blog/other/index.html
|
nvim $FILE
|
||||||
|
CATSTR="$(grep 'X' $FILE | cut -d' ' -f3 | tr -d \\n | sed 's/[A-Z]/ \&\& &/g')"
|
||||||
|
CATFIN="$(echo $CATSTR | cut --complement -d' ' -f1 | sed 's/\(Linux\|Software\|Technology\|Design\|Guides\|Literary\|Other\)/<a style="color:#ff79c6" href="..\/blog\/&\/"><strong>&<\/strong><\/a>/g' | sed 's/\/blog\/\(Linux\|Software\|Technology\|Design\|Guides\|Literary\|Other\)/\L&/g' | sed 's/\//\\\//g' | sed 's/\&\&/\\\&\\\&/g')"
|
||||||
|
POSTED=$(date +'%d %B %Y')
|
||||||
|
read -p "Enter post title: " TITLE
|
||||||
|
read -p "Enter post relative URL: " URL
|
||||||
|
read -p "Enter reading time: " READ
|
||||||
|
read -p "Enter previous post: " PREVPOST
|
||||||
|
EMAIL=$(echo $TITLE | sed 's/ /%20/g')
|
||||||
|
|
||||||
|
cd ~/docs/sys/gits/sufyaan-website
|
||||||
|
mkdir -p $URL
|
||||||
|
cp template.html $URL/index.html
|
||||||
|
|
||||||
|
# Replacing placeholders with values in new post
|
||||||
|
sed -i "s/POST TITLE/$TITLE/g" $URL/index.html
|
||||||
|
sed -i "s/POST DATE/$POSTED/g" $URL/index.html
|
||||||
|
sed -i "s/READING/$READ/g" $URL/index.html
|
||||||
|
sed -i "s/MAILSUBJECT/$EMAIL/g" $URL/index.html
|
||||||
|
sed -i "s/URL/$URL/g" $URL/index.html
|
||||||
|
sed -i "s/PREVIOUSPOST/$PREVPOST/g" $URL/index.html
|
||||||
|
sed -i "s/POSTCATEGORIES/$CATFIN/g" $URL/index.html
|
||||||
|
ORIGINALFOOTER="<a style='color:#bd93f9' href='..\/terminal\/'>First Post<\/a> <svg class='footer-posts' xmlns='http:\/\/www.w3.org\/2000\/svg' width='20' height='20' viewBox='0 0 20 20'><path fill='#bd93f9' fill-rule='evenodd' d='M2.232 12.207a.75.75 0 0 1 1.06.025l3.958 4.146V6.375a5.375 5.375 0 0 1 10.75 0V9.25a.75.75 0 0 1-1.5 0V6.375a3.875 3.875 0 0 0-7.75 0v10.003l3.957-4.146a.75.75 0 0 1 1.085 1.036l-5.25 5.5a.75.75 0 0 1-1.085 0l-5.25-5.5a.75.75 0 0 1 .025-1.06Z' clip-rule='evenodd'\/><\/svg><\/p>"
|
||||||
|
NEWFOOTER="<a style='color:#bd93f9' href=\"..\/$URL\/\">Next Post<\/a> <svg class='footer-posts' xmlns='http:\/\/www.w3.org\/2000\/svg' viewBox='0 0 48 48'><mask id='ipSRightOne0'><path fill='#fff' stroke='#fff' stroke-linejoin='round' stroke-width='4' d='m20 12l12 12l-12 12V12Z'\/><\/mask><path fill='#bd93f9' d='M0 0h48v48H0z' mask='url\(\#ipSRightOne0\)'\/><\/svg><\/p>"
|
||||||
|
sed -i "s/$ORIGINALFOOTER/$NEWFOOTER/g" $PREVPOST/index.html
|
||||||
|
|
||||||
|
# Removing temporary file
|
||||||
|
rm $FILE
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>(POST) POST TITLE</title>
|
||||||
|
<link rel="icon" type="image/x-icon" href="../images/favicon.webp">
|
||||||
|
<link rel='stylesheet' type='text/css' href="../style.css">
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a style="text-decoration: none;" href="../">
|
||||||
|
<pre class="main-header">
|
||||||
|
_______ _ _ _______ __ __ _______ _______ __ _
|
||||||
|
|______ | | |______ \_/ |_____| |_____| | \ |
|
||||||
|
______| |_____| | | | | | | | \_|
|
||||||
|
</pre>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<hr/><p><a href="../">sf.cu</a> > <a style="color:#bd93f9" href="../blog/">Blog</a> > <a style="color:#bd93f9" href=".">POST TITLE</a></p>
|
||||||
|
<h1>POST TITLE</h1>
|
||||||
|
<p style="font-size:110%">Posted on: <strong>POST DATE</strong></p>
|
||||||
|
<p style="font-size:110%">Reading time: <strong><strong>READING min</strong>
|
||||||
|
<p style="font-size:110%"></strong>Category: POSTCATEGORIES</p>
|
||||||
|
|
||||||
|
<p><a href="mailto:sf@sufyaan.me?subject=MAILSUBJECT">>>> Reply To Me</a></p>
|
||||||
|
<p><a href="URL.pdf">>>> Download PDF</a></p>
|
||||||
|
<p style="text-align:center;"><a href="../PREVIOUSPOST/" style="color:#bd93f9"><svg class="footer-posts" xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><mask id="ipSLeftOne0"><path fill="#fff" stroke="#fff" stroke-linejoin="round" stroke-width="4" d="M30 36L18 24l12-12v24Z"/></mask><path fill="#bd93f9" d="M0 0h48v48H0z" mask="url(#ipSLeftOne0)"/></svg>Previous Post</a> - <a style="color:#bd93f9" href="../terminal/">First Post</a> <svg class="footer-posts" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path fill="#bd93f9" fill-rule="evenodd" d="M2.232 12.207a.75.75 0 0 1 1.06.025l3.958 4.146V6.375a5.375 5.375 0 0 1 10.75 0V9.25a.75.75 0 0 1-1.5 0V6.375a3.875 3.875 0 0 0-7.75 0v10.003l3.957-4.146a.75.75 0 0 1 1.085 1.036l-5.25 5.5a.75.75 0 0 1-1.085 0l-5.25-5.5a.75.75 0 0 1 .025-1.06Z" clip-rule="evenodd"/></svg></p>
|
||||||
|
<hr/>
|
||||||
|
<footer>
|
||||||
|
<p class="footer-text"><a style="color:#bd93f9" href="../blog">blog</a> - <a style="color:#ffb86c" href="../about">about</a> - <a style="color:#f1fa8c" href="../portfolio">portfolio</a> - <a style="color:#ff5555" href="../links">links</a></p>
|
||||||
|
<p class="footer-text" style="font-size:80%"><a href="../">sufyaan.me</a></p><p class="footer-text" style="font-size:65%"><a style="color:#aaaaaa" href="../sitemap">Site Map</a></p>
|
||||||
|
</footer>
|
||||||
|
|
Loading…
Reference in New Issue