Skip to content

Instantly share code, notes, and snippets.

@abdiasriver
Forked from codigobash/hugo-github-linux
Last active January 11, 2018 10:22
Show Gist options
  • Save abdiasriver/1010b19511d4cfe76037445e5b784d5d to your computer and use it in GitHub Desktop.
Save abdiasriver/1010b19511d4cfe76037445e5b784d5d to your computer and use it in GitHub Desktop.
0. opcional agregar la clave ssh para no estar poniendo usuarios y contraseñas....
instalamos
git
hugo
openssh
tree
xclip
configurar github con mi usuario y correo
git config --global user.name "abdiasriver"
git config --global user.email "abdias@alumnos.uaslp.edu.mx"
CREAR FIRMA SSH PARA GITHUB y linux
ls -al ~/.ssh
ssh-keygen -t rsa -b 4096 -C "abdias@alumnos.uaslp.edu.mx"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
xclip -sel clip < ~/.ssh/id_rsa.pub
hugo new site abdiasriver
INSTALAMOS UN TEMA https://themes.gohugo.io
cd themes
git clone https://github.com/laozhu/hugo-nuo
COPIAMOS LOS DATOS DE EJEMPLO DEL TEMA SI ES QUE TRAE, ELIMINAMOS LOS DE LA RAIZ
GENERANDO CONTENIDO ESTATICO DEL SITIO (SE CREA UNA CARPETA PUBLIC)
hugo
VER COMO VA EN localhost:1313 EN EL EXPLORADOR WEB
hugo server --watch --buildDrafts
detener con ctrl + c , elimina carpeta public
CREAR UN REPOSITORIO EN GITHUB CON EL NOMBRE DE(en mi caso usuario es abdiasriver) abdiasriver.github.io y marcando readme.md
y cambia localhost:1313 en el archivo de configuracion del sitio creado en hugo, por el de abdiasriver.github.com.io
y volvemos a generar carpeta public del sitio con
hugo
CLONAR EL REPOSITORIO Y ENVIAR LOS ARCHIVOS A LA WEB
git clone git@github.com:abdiasriver/abdiasriver.github.io.git
cp -r public/* abdiasriver.github.io/
cd abdiasriver.github.io
git add .
git commit -m 'mi comentario'
git push
CON ESTO YA EMPEZAMOS A CAMBIAR LO QUE GUSTEN, TODO SE MODIFICA DESDE EL SITIO EN HUGO,
NO EN LA CARPETA PUBLIC, YA QUE CADA VEZ QUE SE DA EL COMANDO hugo SE GENERA O ACTUALIZA LA CARPETA,
LOS POSTS SE ESCRIBEN EN MARKDOWN, Y HAY UNA GUIA DE SHORTCODES EN HUGO PARA FACIITAR TODO.
visita https://usuariodel.club
--------------------------------------------------------------------------------------------------------------------------
1.- crear un repositorio de proyecto avi-go tema
yo lo llame avi-go
git@github.com:abdiasriver/blog.git
2.- crear un repositorio de usuario.github.io el cual mi usuario es abdiasriver quedara como abdiasriver.github.io
git@github.com:aabdiasriver/abdiasriver.github.io.git
3. crear el sitio hugo
mkdir blog
cd blog/
hugo new site .
git init
git remote add origin git@github.com:abdiasriver/blog.git
echo 'public/' > .gitignore
#----------------------------------------opcional cualquier tema
# agregar tema minimal ejemplo
#https://github.com/calintat/minimal
#
$ git submodule add https://github.com/calintat/minimal.git themes/minimal
$ git submodule init
$ git submodule update
#----------------------------------------
3. crear un submodulo dentro del proyecto para avi-go.github.io
git submodule add -b master git@github.com:abdiasriver/abdiasriver.github.io.git public
git init
git update
4. mandar los archivos al proyecto
git add .
git commit -m 'inicio de blog'
git push -u origin master
----------------generar sitio con script--------------
hugo
cd public
git add .
git commmit -m 'inicio del blog'
git push
rm -rf !(.nojekyll|.git)
de ahora en adelante puedes usar este pequeño script , o puedes hacero paso por paso, editalo a tu gusto.
dale permisos con
chmod +x up.sh
ejecutalo dentro del proyecto con
./up.sh "comentario inicial'
# script----------------------------------------------------------------------------
#!/bin/bash
# inicio del script
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo # if using a theme, replace by `hugo -t <yourtheme>`
# Go To Public folder
cd public
# Add changes to git.
git add -A
# Commit changes.
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
# remove all docs except git
rm -rf !(.nojekyll|.git)
# Come Back
cd ..
# fin del script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment