From 4889ae36324223c08f42a0e09f300b0bd441df83 Mon Sep 17 00:00:00 2001 From: BernatBC Date: Wed, 24 Jan 2024 08:19:26 +0100 Subject: [PATCH] Update contributing post --- content/posts/contributing/index.es.md | 81 +++++++++++++++++++------- content/posts/contributing/index.md | 78 ++++++++++++++++++------- 2 files changed, 118 insertions(+), 41 deletions(-) diff --git a/content/posts/contributing/index.es.md b/content/posts/contributing/index.es.md index c5ee6ca2..32a59eb0 100644 --- a/content/posts/contributing/index.es.md +++ b/content/posts/contributing/index.es.md @@ -52,37 +52,76 @@ Para el desarrollo local, puedes hacer cambios al submódulo del tema y probar l Para comenzar, haz fork de [este repositorio](https://github.com/hugo-toha/toha). Después, sigue los siguientes pasos para usar el tema forkeado para el desarrollo local, -#### Usando el tema forkeado en tu propio sitio: -Si quiéres ejecutar el desarrollo local con tu propio sitio, sigue los siguientes pasos: +#### Ejecuta el tema forkeado con el sitio de ejemplo + +Si quieres ejecutar tu desarrollo local con este [sitio de ejemplo](https://github.com/hugo-toha/hugo-toha.github.io), sigue los siguientes pasos: ```bash -# añade el tema original como submódulo de tu sitio si aún no lo has hecho -$ git submodule add https://github.com/hugo-toha/toha.git themes/toha -# navega hacia el directorio del tema de toha -$ cd themes/toha -# añade un fork a github -$ git remote add my-fork https://github.com//toha -# crea una nueva rama para tus cambios -$ git checkout -b mi-nueva-rama +# va al directorio exampleSite +$ cd exampleSite +# instala los módulos de hugo +$ hugo mod tidy +# instala las dependencias +$ hugo mod npm pack +$ npm install +# ejecuta el sitio de ejemplo localmente +$ hugo server -w +``` + +Ahora, puedes hacer cambios en el tema, y se verán reflectados inmediatamente en el sitio. Si necesitas cambiar alguna configuración, lo puedes hacer en el archivo `config.yaml` dentro del directorio `exampleSite`. Si necesitas añadir contenido o datos, puedes crear el respectivo directorio dentro de `exampleSite` y añade tu contenido o datos deseados ahí. + +#### Ejecuta el tema forkeado con tu propio sitio + +Si quieres ejecutar tu desarrollo local con tu sitio, sigue los siguientes pasos: + +**Sustituye los módulos del tema:** + +Abre el archivo `go.mod` de tu sitio y sustituye `github.com/hugo-toha/toha/v4` por el path de tu repositorio forkeado. Por ejemplo, si tu repositorio forkeado es `github.com//toha`, sustituye `github.com/hugo-toha/toha/v4` por `github.com//toha/v4`. + +```go +module github.com/hugo-toha/hugo-toha.github.io + +go 1.19 + +require github.com/hugo-toha/toha/v4 v4.0.1-0.20231229170427-d3968ca711ef // indirect + +replace( + github.com/hugo-toha/toha/v4 => github.com//toha +) +``` + +Para el desarrollo interactivo, puedes sustituir el tema con tu fork clonado localmente. Por ejemplo, si has clonado tu fork en `/home/mis-proyectos/toha`, sustituye `github.com/hugo-toha/toha/v4` por `/home/mis-proyectos/toha`. + +```go +module github.com/hugo-toha/hugo-toha.github.io + +go 1.19 + +require github.com/hugo-toha/toha/v4 v4.0.1-0.20231229170427-d3968ca711ef // indirect + +replace( + github.com/hugo-toha/toha/v4 => /home/my-projects/toha +) ``` -#### Usando el tema forkeado en el sitio de ejemplo +**Actualizar dependencias:** + +```bash +# actualiza los módulos de hugo +$ hugo mod tidy +# instala las dependencias +$ hugo mod npm pack +$ npm install +``` -Si quiéres ejecutar el desarrollo local con este [sitio de ejemplo](https://github.com/hugo-toha/hugo-toha.github.io), sigue los siguientes pasos: +**Ejecuta tu sitio localmente:** ```bash -# clona el sitio de ejemplo junto con los submódulos -$ git clone git@github.com:hugo-toha/hugo-toha.github.io.git --recursive -# navega hacia el directorio del tema de toha -$ cd themes/toha -# añade un fork a github -$ git remote add my-fork https://github.com//toha -# crea una nueva rama para tus cambios -$ git checkout -b mi-nueva-rama +$ hugo server -w ``` -Desde aquí ya puedes hacer cambios al código fuente del tema mientras lo pruebas con to sitio Hugo o con el de ejemplo. +Desde aquí ya puedes hacer cambios al código fuente del tema mientras lo pruebas con tu sitio Hugo o con el de ejemplo. ### Abre un Pull Request diff --git a/content/posts/contributing/index.md b/content/posts/contributing/index.md index 0875187d..3f1c54fa 100644 --- a/content/posts/contributing/index.md +++ b/content/posts/contributing/index.md @@ -51,34 +51,72 @@ For local development, you can make changes in the theme submodule and test the At first, fork [this repo](https://github.com/hugo-toha/toha). Then, follow the following steps to use the forked theme for local developments, -#### Using the forked theme in your own site: +#### Running the forked theme against the example site -If you want to run your local development against your own site, follow the following steps: +If your want to run your local development against this [example site](https://github.com/hugo-toha/hugo-toha.github.io), follow the following steps: ```bash -# add the original theme as a submodule of your site if you haven't done already -$ git submodule add https://github.com/hugo-toha/toha.git themes/toha -# navigate into the toha theme folder -$ cd themes/toha -# add your own fork as a remote -$ git remote add my-fork https://github.com//toha -# create a new branch for your changes -$ git checkout -b my-feature-branch +# go to exampleSite directory +$ cd exampleSite +# install hugo modules +$ hugo mod tidy +# install dependencies +$ hugo mod npm pack +$ npm install +# run the example site locally +$ hugo server -w ``` -#### Using the forked theme in the example site: +Now, you can make change in the theme and they will be reflected immediately on the running site. If you need to change any configuration, you can do that in the `config.yaml` file inside `exampleSite` folder. If you need to add any content or data, you can create the respective folder inside `exampleSite` directory and add your desired content or data there. -If your want to run your local development against this [example site](https://github.com/hugo-toha/hugo-toha.github.io), follow the following steps: +#### Running the forked theme against your own site + +If you want to run your local development against your own site, follow the following steps: + +**Replace the theme module:** + +Open your site's `go.mod` file and replace the `github.com/hugo-toha/toha/v4` with your forked repo's path. For example, if your forked repo is `github.com//toha`, then replace the `github.com/hugo-toha/toha/v4` with `github.com//toha/v4`. + +```go +module github.com/hugo-toha/hugo-toha.github.io + +go 1.19 + +require github.com/hugo-toha/toha/v4 v4.0.1-0.20231229170427-d3968ca711ef // indirect + +replace( + github.com/hugo-toha/toha/v4 => github.com//toha +) +``` + +For interactive development, you can replace the theme with your locally cloned fork. For example, if you have cloned your fork in `/home/my-projects/toha`, then replace the `github.com/hugo-toha/toha/v4` with `/home/my-projects/toha`. + +```go +module github.com/hugo-toha/hugo-toha.github.io + +go 1.19 + +require github.com/hugo-toha/toha/v4 v4.0.1-0.20231229170427-d3968ca711ef // indirect + +replace( + github.com/hugo-toha/toha/v4 => /home/my-projects/toha +) +``` + +**Update dependencies:** + +```bash +# update hugo modules +$ hugo mod tidy +# install dependencies +$ hugo mod npm pack +$ npm install +``` + +**Run your site locally:** ```bash -# clone the example site along with the submodules -$ git clone git@github.com:hugo-toha/hugo-toha.github.io.git --recursive -# navigate into the toha theme folder -$ cd themes/toha -# add your own fork as a remote -$ git remote add my-fork https://github.com//toha -# create a new branch for your changes -$ git checkout -b my-feature-branch +$ hugo server -w ``` From there you can make changes to the source code of the theme while testing with your running Hugo site or the example site.