Urls on GitLab hosted pages
rastacalavera opened this issue · 14 comments
Back again!
I got the theme working but for some reason when I try to use it on a hosted gitlab page instance, the results are mixed.
Here is what I am experiencing:
baseurl= "https://rastacalavera.gitlab.io/linuxlemming/"
- Theme works
- gitlab page url works fine, all links work
- linuxlemming.com landing pages works with theme
- none of the links work. All have an extra
/linuxlemming/
baseurl= "https://www.linuxlemming.com/"
- gitlab page loads but there is no theme
- none of the links work, they all 404.
- after the main "rastacalavera.gitlab.io/" there is no "/linuxlemming/"
- linuxlemming.com loads but there is no theme
- all links work
After searching forum posts and the main documents, it seems as if using relativeURLS = true
is a no go and I've made sure to include the final /
on all the others.
I saw some things in the issue tracker that are marked as a "Chore". Maybe I can help out with those? I am not a coder but I can certainly delete stuff and make sure it still functions as expected now that I understand things a little better.
Thanks again for an awesome theme!
Here is my config:
#baseurl = "http://localhost:1313"
baseurl = "https:www.linuxlemming.com/"
#baseurl = "https://rastacalavera.gitlab.io/linuxlemming/"
#relativeURLs = true
languageCode = "en-us"
title = "The Linux Lemming"
theme = "castanet"
googleAnalytics = ""
paginate = "9"
buildFuture = true
[taxonomies]
category = "categories"
series = "series"
tag = "tags"
[permalinks]
page = "../..:filename/"
about = "../..:filename/"
episode = "../..:filename/"
# The theme supports menus with up to one submenu per menu item
# The menu name must be "Main"
# The menus are sorted based upon their identifier
[[Menu.Main]]
name = "About"
#identifier = "about"
url = "/TLL"
#[[Menu.Main]]
# name = "Contact"
# identifier = "contact"
# url = "/contact"
[[Menu.Main]]
name = "Host"
identifier = "hosts"
url = "/host"
[[Menu.Main]]
name = "Guests"
identifier = "guests"
url = "/guest"
[[Menu.Main]]
name = "Upcoming Episodes"
identifier = "upcoming"
url = "/upcoming"
[[Menu.Main]]
name = "Blog"
identifier = "blog"
url = "/blog"
[[Menu.Main]]
name = "Resources"
identifier = "resources"
url = "#!"
#[[Menu.Main]]
# name = "Books"
# identifier = "books"
# url = "/books"
# parent = "resources"
[[Menu.Main]]
name = "Podcasts"
identifier = "podcasts"
url = "/Other Podcasts"
parent = "resources"
[params]
mainSections = ["episode"]
episode_number_style = "brackets"
episode_number_prefix = "CWC"
site_theme = "grey"
# site_layout = "grid"
site_layout = "row"
show_next_upcoming = "false"
enable_jumbo = "true"
# enable_jumbo = "false"
# truncate = "100"
about_logo = "/img/host/rastacalavera.jpg"
copyright_notice = "Copyright 2021 The Linux Lemming"
#itunes_subscribe = "https://podcasts.apple.com/us/podcast/arrested-devops/id773888088?ign-mpt=uo%3D4&mt=2"
#android_subscribe = "http://subscribeonandroid.com/feeds.podtrac.com/VGAulpN7MY1U"
#spotify_subscribe = "https://open.spotify.com/show/..."
#google_play_subscribe = "https://podcasts.google.com/feed/aHR0cHM6Ly93d3cuYXJyZXN0ZWRkZXZvcHMuY29tL2VwaXNvZGUvaW5kZXgueG1s"
#stitcher_subscribe = "http://www.stitcher.com/podcast/arrested-devops-2/arrested-devops"
#soundcloud_subscribe = "http://feeds.soundcloud.com/users/soundcloud:users:203144248/sounds.rss"
#pocketcasts_subscribe = "http://pcasts.in/feed/feeds.soundcloud.com/users/soundcloud:users:203144248/sounds.rss"
#mailchimp_subscribe = "//arresteddevops.us3.list-manage.com/subscribe/post?u=5e4cbcac996bb9df25f970a89&id=154fa76bcc"
# rss_subscribe = "http://feed.com/myfeed" #only set this if you don't want to use the built-in feed
description = "The Linux Lemming is here to help you find solid, accurate information in the self-hosting world and to improve documentation for projects as errors arise. "
#media_prefix = "https://media.blubrry.com/arresteddevops/content.blubrry.com/arresteddevops/"
disqusShortname = ""
[params.feed]
copyright = "Copyright 2021 The Linux Lemming" #do not use markdown in this field; it is used in the feed
# itunes_subtitle = "The best podcast ever" #no markdown or HTML
# itunes_author = "Matt Stratton" #no markdown or HTML
# itunes_summary = "The HugoCast is the best podcast you've ever seen. You will learn everything you ever needed to know about podcasting from the most inspiring experts to ever show up on the whole internet." # Limited to 4000 characters or less, plain text, no HTML
# itunes_owner_name = "Matt Stratton"
# itunes_owner_email = "matt.stratton@gmail.com" #contains the e-mail address that will be used to contact the owner of the Podcast for communication specifically about their Podcast on Apple Podcasts. It will not be publicly displayed on Apple Podcasts.
# itunes_image = "https://www.arresteddevops.com/img/hosts/rastacalavera.jpg" #fqdn to the image art for your podcast
# itunes_top_category = "Technology"
# itunes_first_sub_category = "Software How-To"
# itunes_second_sub_category = "Tech News"
language = "en-us"
[params.realfavicongenerator] # https://realfavicongenerator.net/
mask_icon_color="#5bbad5"
msapplication_tilecolor="#2b5797"
theme_color="#ffffff"
[params.podlove] # https://subscribe-button.podlove.org
subscribe_title = "" # fallback: site title from above
subscribe_subtitle = "" # fallback: ""
subscribe_description = "" # fallback: ""
subscribe_cover = "img/logo.jpg" # fallback: ""
subscribe_color = "#585e6c" # fallback: ""
subscribe_size = "medium" # options: small, medium, big
subscribe_format = "rectangle" # options: rectangle, square, cover
subscribe_style = "filled" # options: filled, outline, frameless
subscribe_language = "en" # options: nl (dutch), en (english), eo (esperanto), de (german), fi (finnish), fr (french), ja (french)
subscribe_feed_type = "audio" # options: audio, video
subscribe_feed_format = "mp3" # options: mp3, aac, ogg, opus
[params.social]
github = "rastacalavera"
gitlab = "rastacalavera"
# facebook = "Arresteddevops"
# facebook_admin = ["500557137","1234"] # This needs to be one or more page admins to get domain insights
# twitter = "arresteddevops"
# twitter_domain = "arresteddevops.com" # This domain shows in twitter cards as "View on `twitter_domain`"
# googleplus = "ArrestedDevOps"
# pinterest = "nozzleio"
# instagram = "nozzleio"
# youtube = "arresteddevops"
# linkedin = "mattstratton"
# twitch = "mattstratton"
[params.authors]
[params.authors.RastaCalavera]
name = "RastaCalavera"
thumbnail = "img/host/edited.jpg" #main circle image on landing page
bio = "A Linux enthusiast and maker at heart. "
[params.authors.RastaCalavera.social]
github = "rastacalavera"
# facebook = "matt.stratton"
# twitter = "mattstratton"
# linkedin = "mattstratton"
# homepage = "https://www.mattstratton.io"
# pinterest = "mattstratton"
# instagram = "instagram"
# youtube = "mattstratton"
# twitch = "mattstratton"
[params.links]
[params.links.ado]
name = "Arrested DevOps"
url = "https://www.arresteddevops.com"
[params.links.ffs]
name = "Food Fight Show"
url = "https://foodfightshow.org"
[params.links.sdt]
name = "Software Defined Talk"
url = "https://cote.io/podcasts/sdt/"
You will need something that builds the site before pushing to gitlab pages? What is your build process? Do you build the site locally and then deploy, or are you using a CI pipeline?
if your repo is public, can you provide a link to it? I can take a look at it.
and all contributions are welcome! Please comment on the issues if there is any additional context I can provide to them (some of them are definitely written assuming the person reading them is me lol)
Thanks for the reply! Yeah I am using a CI pipeline and it is passing all checks. My repo is https://gitlab.com/rastacalavera/linuxlemming and you should be able to see everything. When I've done simple deployments before, I've had to set the base url to the gitlab url. This is the first time I am using a personal domain.
When i deploy locally, everything works as expected when the base url is set to local host.
GitLabGitLab.com
You mgiht need to set the BASEURL in the build command! For example this is the script that netlify calls when I build arrested devops: https://github.com/arresteddevops/ado-hugo/blob/main/bin/netlify-production.sh
(the $URL
is a variable from netlify)
So maybe something like this in .gitlab-ci.yml
(this is pseudocode)
pages:
script:
- hugo --theme=castanet --baseURL=https//:www.linuxlemming.com/
artifacts:
paths:
- public
only:
- master
I also noticed that in your config.toml you have a typo:
baseurl = "https:www.linuxlemming.com/"
changing that to:
baseurl = "https://www.linuxlemming.com/"
might fix it too!
Source code for the ADO website. Contribute to arresteddevops/ado-hugo development by creating an account on GitHub.
Not sure, but this might be causing some issues somewhere too:
[permalinks]
page = "../..:filename/"
about = "../..:filename/"
episode = "../..:filename/"
the structure I use is:
[permalinks]
# page = "/:filename/"
about = "/:filename/"
episode = "/:filename/"
but I might not be reading your use correctly!
I suspect that the reason you were not getting the theme is that it couldn't load the stylesheet; one thing I like to do is load up chrome dev tools and look for any 404s on the CSS files in the sources, etc
hmmm well the typo and the leading/trailing "..." were totally a symptom of trying to many things and trying to put them back together by memory. I think you are on to something with the css style sheet not working.
This comes up when using my main domain:
Loading failed for the <script> with source “https://www.linuxlemming.com/js/castanet-min.js”.
And when using the gitlab domain there is no error. https://rastacalavera.gitlab.io/linuxlemming/
It's all very odd. Like on the domain url https://linuxlemming.com/blog/ that looks and behaves as expected but when you click around, the urls take you back to the gitlab url
The Linux Lemming
The Linux Lemming is here to help you find solid, accurate information in the self-hosting world and to improve documentation for projects as errors arise.
unfortunately, I don't have a lot of experience with gitlab pages, so I'm not 100% sure why URLs might be rewritten somewhere (or what the gitlab pages site thinks is the actual URL of it, etc?)
I don't think this is an issue, but you might try setting canonifyurls = true
in your config.toml (when using the domain as the baseURL)? I think that it's trying to parse relative to the directory that gitlab pages has it in?
I wonder if it would help to change this code in layouts/partials/header.html
change:
<a href="{{ .URL }}" class="nav-link">
to
<a href="{{ .URL | absURL }}" class="nav-link">
I'm leery about that change because...it will only work for on-site links in the menu. I think. I forget what happens if you pass an absolute URL to absURL
.
If you want to try that in your local copy and see if that helps, we can see about putting that into the released theme.
fwiw I just tested that and it doesn't break anything, so there's that. I'll put in a PR to add that fix. I don't know if it will help you or not, but it can't hurt!
Once I merge #343 i'll push a new release. Again, I don' tknow that this will fix your issue, but this did make me see a little bit of cleanup that might help!
The absURL
issue was pushed in https://github.com/mattstratton/castanet/releases/tag/1.14.4
Fixed bugs:Add absURL to menus #343 (mattstratton)
Huzzah! That layout change WITH the canonifyURLs = true
addition has it up and running!! Thanks a ton for your investigative work and willingness to help me troubleshot today!!
I noticed your site doesn't have a buy me a coffee or patreon so I hope I can contribute to your project through documentation and testing for you.
Thanks again!
I hope I can contribute to your project through documentation and testing for you.
absolutely! and once you get your site up and running, send in a PR to the README to add it to the list of sites using the theme!