Codeberg/Community
60
387
Fork
You've already forked Community
12

Specify sub-folder location for Codeberg Pages index.html #410

Closed
opened 2021年03月05日 09:23:59 +01:00 by circlebuilder · 7 comments

My pages repository contains html generated via Jekyll,

The process of publishing requires another repo. In a separate Jekyll source repository I first do a jekyll build. This places site output in the _site folder, and the contents of this directory I then commit to pages repo.

Is there a means by which I could use just a single repo and specify the subdir where Codeberg Pages should pick up the index.html to render from?

My `pages` repository contains html generated via Jekyll, The process of publishing requires another repo. In a separate Jekyll source repository I first do a `jekyll build`. This places site output in the `_site` folder, and the contents of this directory I then commit to `pages` repo. Is there a means by which I could use just a single repo and specify the subdir where Codeberg Pages should pick up the `index.html` to render from?
Member
Copy link

Does jekyll's jekyll build --destination <DIRECTORY> option work for you? I think this can also be specified in the jekyll project config file.

Does jekyll's `jekyll build --destination <DIRECTORY>` option work for you? I think this can also be specified in the jekyll project config file.
Owner
Copy link

The process of publishing requires another repo

Please note that you do not need to split the generator and the output into separate repositories, you can also use different branches in the same repo if this is more convenient to you. The pages will be served from the default branch, so you could create a "source" (or "whatever") branch and point to that in the Readme. I do not know if there's a more elegant way for generation than having two clones of the repo locally with different branches.

I think, in the medium term we could also introduce some pages config file placed in the repo to specify behaviour like this.

> The process of publishing requires another repo Please note that you do not need to split the generator and the output into separate repositories, you can also use different branches in the same repo if this is more convenient to you. The pages will be served from the default branch, so you could create a "source" (or "whatever") branch and point to that in the Readme. I do not know if there's a more elegant way for generation than having two clones of the repo locally with different branches. I think, in the medium term we could also introduce some pages config file placed in the repo to specify behaviour like this.

Thank you @hw and @fnetX .. both these solutions are not ideal.

The jekyll build --destination might work locally to avoid a manual copy/paste, but I think a jekyll clean will erase the .git subdir then (have to test). In a single-repo setup I don't want the output in the root of the repo (plus this already contains an index.html which would clash).

The two branches solution is an option, but I find it unintuitive that the design files are not in the default branch, and by default not visible to others.

I'll stick with current procedure and wait for a config-file option, which would be great to have. And it may also be used for other config e.g. if/when you decide to add custom domain name support (#115).

Thank you @hw and @fnetX .. both these solutions are not ideal. The `jekyll build --destination` might work locally to avoid a manual copy/paste, but I think a `jekyll clean` will erase the `.git` subdir then (have to test). In a single-repo setup I don't want the output in the root of the repo (plus this already contains an `index.html` which would clash). The two branches solution is an option, but I find it unintuitive that the design files are not in the default branch, and by default not visible to others. I'll stick with current procedure and wait for a config-file option, which would be great to have. And it may also be used for other config e.g. if/when you decide to add custom domain name support (#115).
Owner
Copy link

The next version of pages will always try to use a "pages" branch first, so that should solve the default branch problem.

For the sake of feature creep, the rest of this won't happen from my side - you can use branches & worktrees for that like this though:

tempdir=$(mktemp -d)
git worktree add "$tempdir" pages
jekyll clean --destination "$tempdir"
jekyll build --destination "$tempdir"
( cd "$tempdir" && git add -A && git commit -m "Build at $(date -Is)"; )
git push origin pages
rm -r "$tempdir"
The next version of pages will always try to use a "pages" branch first, so that should solve the default branch problem. For the sake of feature creep, the rest of this won't happen from my side - you can use branches & worktrees for that like this though: ```bash tempdir=$(mktemp -d) git worktree add "$tempdir" pages jekyll clean --destination "$tempdir" jekyll build --destination "$tempdir" ( cd "$tempdir" && git add -A && git commit -m "Build at $(date -Is)"; ) git push origin pages rm -r "$tempdir" ```
momar 2021年05月14日 11:07:12 +02:00

Thanks for pasting that script, and for the great work you do on Pages 💚 This will work fine for me.

Thanks for pasting that script, and for the great work you do on Pages 💚 This will work fine for me.
tempdir=$(mktemp -d)
git worktree add "$tempdir" pages
hugo --destination "$tempdir"
( cd "$tempdir" && git add -A && git commit -m "Build at $(date -Is)"; )
git push origin pages
rm -r "$tempdir"

Hello,

i tried this with hugo but somehow it mixes the source files and the created files:
https://codeberg.org/ButterflyAspect/page-source/src/branch/pages

```bash tempdir=$(mktemp -d) git worktree add "$tempdir" pages hugo --destination "$tempdir" ( cd "$tempdir" && git add -A && git commit -m "Build at $(date -Is)"; ) git push origin pages rm -r "$tempdir" ``` Hello, i tried this with hugo but somehow it mixes the source files and the created files: https://codeberg.org/ButterflyAspect/page-source/src/branch/pages

Can confirm. Happened to me too. We use a different script now, but - though it works - it still has issues to solve (this is with Jekyll).

Can confirm. Happened to me too. We use [a different script](https://codeberg.org/SocialCoding/website/src/branch/main/build.sh) now, but - though it works - it still [has issues to solve](https://codeberg.org/SocialCoding/website/issues/2#issuecomment-292722) (this is with Jekyll).
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Labels
Clear labels
accessibility
Reduces accessibility and is thus a "bug" for certain user groups on Codeberg.
bug
Something is not working the way it should. Does not concern outages.
bug
infrastructure
Errors evidently caused by infrastructure malfunctions or outages
Codeberg
This issue involves Codeberg's downstream modifications and settings and/or Codeberg's structures.
contributions welcome
Please join the discussion and consider contributing a PR!
docs
No bug, but an improvement to the docs or UI description will help
duplicate
This issue or pull request already exists
enhancement
New feature
infrastructure
Involves changes to the server setups, use `bug/infrastructure` for infrastructure-related user errors.
legal
An issue directly involving legal compliance
licence / ToS
involving questions about the ToS, especially licencing compliance
please chill
we are volunteers
Please consider editing your posts and remember that there is a human on the other side. We get that you are frustrated, but it's harder for us to help you this way.
public relations
Things related to Codeberg's external communication
question
More information is needed
question
user support
This issue contains a clearly stated problem. However, it is not clear whether we have to fix anything on Codeberg's end, but we're helping them fix it and/or find the cause.
s/Forgejo
Related to Forgejo. Please also check Forgejo's issue tracker.
s/Forgejo/migration
Migration related issues in Forgejo
s/Pages
Issues related to the Codeberg Pages feature
s/Weblate
Issue is related to the Weblate instance at https://translate.codeberg.org
s/Woodpecker
Woodpecker CI related issue
security
involves improvements to the sites security
service
Add a new service to the Codeberg ecosystem (instead of implementing into Forgejo)
upstream
An open issue or pull request to an upstream repository to fix this issue (partially or completely) exists (i.e. Forgejo, Weblate, etc.)
wontfix
Codeberg's current set of contributors are not planning to spend time on delegating this issue.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Codeberg/Community#410
Reference in a new issue
Codeberg/Community
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?