# Baseurl, url, and other settings when using GitHub Actions?

**URL:** <https://talk.jekyllrb.com/t/baseurl-url-and-other-settings-when-using-github-actions/6314>\
**Category:** Help\
**Created:** [August 11, 2021, 9:19pm UTC](https://talk.jekyllrb.com/t/baseurl-url-and-other-settings-when-using-github-actions/6314 "2021-08-11T21:19:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BillRaymond](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/billraymond/32/5963_2.png) [@BillRaymond](https://talk.jekyllrb.com/u/BillRaymond)\
**Post date:** [August 11, 2021, 9:19pm UTC](https://talk.jekyllrb.com/t/baseurl-url-and-other-settings-when-using-github-actions/6314/1 "2021-08-11T21:19:37Z")

</div>

I am moving from GitHub Pages to building my site with GitHub Actions. There will be a Jekyll site repo just for writing code and posts. I am using [Forestry.io](http://Forestry.io), so I do want it to build and show the site functioning using the Forestry preview options.

I will plan to develop locally, use [forestry.io](http://forestry.io) as mentioned above, and also display the website via a custom domain from another GitHub repo (not another branch).

My primary concerns are that I can:

1. Modify and test code locally
2. Create posts and preview them in Forestry
3. Get proper absolute and relative urls in the final Jekyll website

Before I go and kick off this project, my biggest question is whether or not I should be setting up multiple `baseurl` and `url` items in the `_config.yml` file? Are there any other things I might be missing in terms of having the flexibility between moving between local and remote dev repos and a prod repo?

Thanks!

---

<div class="post-metadata">

**Author:** ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)\
**Post date:** [August 12, 2021, 3:25am UTC](https://talk.jekyllrb.com/t/baseurl-url-and-other-settings-when-using-github-actions/6314/2 "2021-08-12T03:25:35Z")

</div>

pretty sure you only need a baseurl if you are using a project on GH - or are otherwise hosting via a subfolder. If you are using a custom domain you shouldn’t need a baseurl unless you want to host it at `mysite.com/blog` or something like that.

When I do stuff with AWS Amplify it uses a subdomain with a weird url - and that is fine, it is not a sub folder like GH does if that is what you are worried about with forestry. I don’t use it so I am not sure what it does but if you are saying it makes a preview site at `xyz.forestry.io` that is just your site you should be fine.

Personally I stay away from absolute urls except if I want to set a canonical meta tag in the head - then I use an absolute url for that, but everything else is a relative url to the root of the site. From what I have read there is no advantage to using absolute urls, but it does have disadvantages for they type of things you are talking about.

I’m not exactly an expert though!

---

<div class="post-metadata">

**Author:** ![BillRaymond](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/billraymond/32/5963_2.png) [@BillRaymond](https://talk.jekyllrb.com/u/BillRaymond)\
**Post date:** [August 12, 2021, 3:27pm UTC](https://talk.jekyllrb.com/t/baseurl-url-and-other-settings-when-using-github-actions/6314/3 "2021-08-12T15:27:11Z")

</div>

Thank you for this. So far, I know I can do local development using an empty `baseurl` since my Jekyll site is at the root folder. I can also debug and test on my local machine using the domain name of `agileinaction.com` without any errors. The bigger concern was building to the separate site, which I will hopefully be doing by end of this week/first thing next week. I’ll update this post as the answer if no problems or report back 🙂

Thanks so much!

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [August 13, 2021, 6:24am UTC](https://talk.jekyllrb.com/t/baseurl-url-and-other-settings-when-using-github-actions/6314/4 "2021-08-13T06:24:07Z")

</div>

Hmm there are a lot of pieces to your question.

The thing that stands out is custom domain.

If your idea is to serve on the root of

> **[Cambermast Agile in Action](https://www.cambermast.com/feed/podcast)**
>
> Cambermast is an award-winning strategic consulting firm focused on helping you stay relevant in today’s fast-paced, technology-driven economy. We specialize in agile transformation, coaching, and training.

Then you do want an empty baseurl.

It doesn’t matter whether your repo ends up being on a subpage or the root on GH Pages, because the end result will be on the root. Therefore you should set

```auto
url: https://agileinaction.com
baseurl: ''

```

Even if it ends up being on

[MyOtherAccount.github.io/agileinactionsite](http://MyOtherAccount.github.io/agileinactionsite)

As the custom domain lack of subpath.

If it weren’t for that need, I’d say set baseurl in the config. And have that set on Forestry config if needed and for local use so you use subpath throughout.

* * *

I don’t know why you need to build to a separate repo. I find building to gh-pages branch works

An advantage is that maybe you have the one repo and it’s GH Pages set up as your staging site. And you tell Google not to crawl it. Then push a bunch of commits or PRs there. And use that as your preview. Without Forestry to handle a preview.

Then use GH Actions to build the site across repos selectively like on a tag made, commit to master, or “ci” in commit message

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [August 13, 2021, 6:27am UTC](https://talk.jekyllrb.com/t/baseurl-url-and-other-settings-when-using-github-actions/6314/5 "2021-08-13T06:27:55Z")

</div>

Having multiple configs is not useful here.

Url field only gets used on a production build with JEKYLL\_ENV=production and won’t be used locally unless you specially want to test contents of RSS or sitemap files.

Oh I guess Forestry would probably need that Jekyll env to be development ie not prod, so that the preview mode serves on localhost and not on the prod URL. That way you don’t need another url for Forestry set up

And it is best to keep the same baseurl on all environments to keep things consistent and close to the final result.
