Skip to content

Commit

Permalink
remove baseurl from metadata.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-demin committed Nov 11, 2024
1 parent 32137d3 commit 632d7fc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pandoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: pages
uses: actions/configure-pages@v5
- name: Build with Pandoc
run: make BASE=${{ steps.pages.outputs.base_path }}
run: make BASE_URL=${{ steps.pages.outputs.base_url }} BASE_PATH=${{ steps.pages.outputs.base_path }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
BASE =
BASE_URL =
BASE_PATH =

SITE = _site

PAGES = $(filter-out index, $(basename $(notdir $(wildcard md/*.md))))
CONTENT = $(addprefix $(SITE)/, etc css img index.html $(addsuffix /index.html, $(PAGES)))

PANDOC = pandoc --defaults defaults.yml --metadata base=$(abspath $(BASE))
PANDOC = pandoc -d defaults.yml -M base_url=$(BASE_URL) -M base_path=$(BASE_PATH)

MKDIR = mkdir -p
CP = cp -r
Expand All @@ -20,7 +22,7 @@ $(SITE)/%: %
$(SITE)/%.html $(SITE)/%/index.html: md/%.md
@echo ">> Converting $^"
@$(MKDIR) $(@D)
@$(PANDOC) --metadata page=$* --output $@ $^
@$(PANDOC) -M page=$* -o $@ $^

serve:
@python3 -m http.server --bind 127.0.0.1 --directory $(SITE)
Expand Down
8 changes: 4 additions & 4 deletions filters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ end
function change_meta(m)
meta = m
if m.page == "index" then
m.canonical = stringify(m.baseurl) .. "/"
m.canonical = stringify(m.base_url) .. "/"
else
m.canonical = stringify(m.baseurl) .. "/" .. m.page .. "/"
m.canonical = stringify(m.base_url) .. "/" .. m.page .. "/"
end
m.title = title or m.site_title
return m
Expand All @@ -24,14 +24,14 @@ function change_link_target(l)
if meta[l.target] then
l.target = stringify(meta[l.target])
elseif l.target:sub(1, 1) == "/" then
l.target = meta.base .. l.target
l.target = meta.base_path .. l.target
end
return l
end

function change_image_src(i)
if i.src:sub(1, 1) == "/" then
i.src = meta.base .. i.src
i.src = meta.base_path .. i.src
end
return i
end
Expand Down
2 changes: 0 additions & 2 deletions metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ site_title: Red Pitaya Notes

description: Notes on the Red Pitaya Open Source Instrument

baseurl: https://pavel-demin.github.io/red-pitaya-notes

source: https://github.com/pavel-demin/red-pitaya-notes
issues: https://github.com/pavel-demin/red-pitaya-notes/issues

Expand Down
4 changes: 2 additions & 2 deletions page.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="${description}">
<link rel="canonical" href="${canonical}">
<link rel="stylesheet" href="${base}/css/main.css">
<link rel="stylesheet" href="${base_path}/css/main.css">
<title>${title}</title>
</head>
<body>
<header>
<div>
<a href="${base}/">${site_title}</a>
<a href="${base_path}/">${site_title}</a>
</div>
<div>
<a href="${source}">Source</a>
Expand Down

0 comments on commit 632d7fc

Please sign in to comment.