Skip to content

Add default layout#144

Merged
ivan-hc merged 8 commits into
Portable-Linux-Apps:mainfrom
andy5995:add-default-layout
May 22, 2026
Merged

Add default layout#144
ivan-hc merged 8 commits into
Portable-Linux-Apps:mainfrom
andy5995:add-default-layout

Conversation

@andy5995
Copy link
Copy Markdown
Contributor

I'll mark this as draft for now. I want to do some more testing. For you, this would mean when you want to make changes to the content in category.html, you wouldn't use the script to regenerate the changes.

The script is in AM must be updated to , which I'm doing now.

@andy5995
Copy link
Copy Markdown
Contributor Author

@ivan-hc Do you have docker installed? Can you have a look using the instructions at https://github.com/andy5995/Portable-Linux-Apps.github.io/blob/8d6069b34e479349cfa13a5c3382f635bbd4aadf/README.md#option-1-docker-recommended-no-local-ruby-needed to see if you notice anything unusual, or something you don't like?

@ivan-hc
Copy link
Copy Markdown
Contributor

ivan-hc commented May 22, 2026

Do you have docker installed?

No, I don't use it. Same thing as podman. I don't use containers anymore.

andy5995 and others added 6 commits May 22, 2026 18:08
* New _layouts/category.html injects the search-box markup at the top
  of the content area and inherits the theme's default layout.
* Apply `layout: category` to apps.md and the 24 category pages
  (appimages, am-utils, android, audio, comic, command-line,
  communication, disk, education, file-manager, finance, game,
  gnome, graphic, internet, kde, office, password, steam,
  system-monitor, video, web-app, web-browser, wine).
* Update assets/js/search.js to locate the apps table by its
  "PACKAGE NAME" header cell rather than the next-sibling heuristic,
  so the filter still works now that the input is at the top of the
  page.
* Drop the inline `<div id="app-search-box">` block from apps.md —
  the layout supplies it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 24 category pages had byte-identical footers and apps.md had a
nearly identical one (differing only in the back-link table). Lift that
block into _layouts/category.html so it lives in one place.

* _layouts/category.html now renders the page content followed by the
  shared "improve these pages / gift to the Linux community / back-links
  / Contacts / support / copyright" block, using `markdownify` so the
  source stays readable.
* A `{% if page.url == "/apps.html" %}` switch picks between the
  "[Home]" back-link (for apps.md) and the "[Back to Home] | [Back to
  Applications]" pair (for the 24 category pages).
* Strip the now-duplicated footer block from all 25 .md files.

Net: -570 source lines, single source of truth for the footer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The generator script overwrites apps.md, appimages.md, and the 24
category .md files on every run. Without these changes, the next run
would erase both the `layout: category` frontmatter and the inline
footer would come back, undoing the previous two commits.

* Add a _frontmatter() helper that emits `---\nlayout: category\n---`
  and call it before writing each generated page.
* Drop _footer_apps and _footer_categories calls (and the now-dead
  _footer_up / _footer_down / _categories_buttons_on_footer / _footer_apps
  / _footer_categories function definitions) — the layout supplies the
  footer.
* Update the "Use your browser's built-in search tool…" line in the
  three header functions to point at the new on-page search box, and
  back-fill the same wording into the 24 category .md files plus
  appimages.md so the repo state matches what the script now emits.

Note: /home/andy/src/AM/tools/am2pla-site (the upstream copy in the AM
repo) differs from this one only by an `xdg-user-dir DESKTOP` cd line
and needs the same changes applied separately.

Separately, _compile_the_homepage() relies on hard-coded sed line ranges
(1-10, 12-19, 25+) that no longer match index.md after PR Portable-Linux-Apps#142 added
the home-page search-box markup. Running the script now would chop that
markup and duplicate the categories nav. That's a pre-existing fragility
worth addressing in its own change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The old _compile_the_homepage relied on hard-coded sed line ranges
(1-10, 12-19, 25-end) to decide what to keep and what to regenerate.
That broke as soon as PR Portable-Linux-Apps#142 added the home-page search box (lines
21-28 of current index.md): running the script would chop the search
box markup and emit a duplicate categories nav.

Replace the line-range logic with content-keyed in-place replacement:
walk index.md with awk and rewrite only the two lines that are actually
auto-generated — the "This site lists N unique apps…" stats line and
the "***[AppImages](appimages.md)***…" categories list. Everything
else (intros, buttons, the search box, links, dividers) is hand-edited
content and passes through untouched, regardless of where it sits.

Also drop the now-unused ./index.old intermediate file from the
end-of-script cleanup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The jekyll/jekyll:pages image is unmaintained and no longer builds:
its Alpine base lacks a C toolchain for current activesupport
transitive deps. Use the official ruby:3.3 image instead, which
matches the Ruby version GitHub Pages builds with and lets bundler
resolve the current github-pages gem cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous commit (d1cb1b3) deleted the per-page footer from all 25
category .md files now that the layout renders it. But the am2pla-site
generator script overwrites these files on every run, so the steady
state of the .md files is determined by the script, not by what's
checked in. Keeping the deletions in the PR adds 600 lines of noise to
the diff without affecting the rendered output once am2pla-site runs
again.

Restore the inline footer to keep the PR diff focused on the layout
extraction itself. Pages will briefly render the footer twice until
the next am2pla-site run, after which the script (taught about the
layout in 0d4fd17) overwrites the .md files without the footer block.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@andy5995 andy5995 force-pushed the add-default-layout branch from 8d6069b to 1d99720 Compare May 22, 2026 23:09
@ivan-hc
Copy link
Copy Markdown
Contributor

ivan-hc commented May 22, 2026

The categories.html and search.js files can be already added, but if we don't change the am2pla-site script first, all other changes will be overwrite.

@andy5995
Copy link
Copy Markdown
Contributor Author

@ivan-hc Ok. So the overall changes in the PR, you are interested once we work out the details and make sure everything is done correctly?

@andy5995 andy5995 marked this pull request as ready for review May 22, 2026 23:11
A prior sync of am2pla-site (b612b7d) ran the pre-260991de script
whose line-range sed logic mangled index.md when PR Portable-Linux-Apps#142's home search
box was already on the page: the <div id="home-search"> wrapper and
the <input> got dropped, three orphan child <div>s were left behind,
and a duplicate "Categories" block was inserted between the images
table and the orphans.

Restore the wrapper + <label> + <input> and remove the duplicate
Categories block so the home search box renders again. The current
am2pla-site in this repo uses awk-based in-place replacement and will
preserve this block on future runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ivan-hc
Copy link
Copy Markdown
Contributor

ivan-hc commented May 22, 2026

Yes. And for now to fix the am2pla-site script is a priority.

It can be executed on the XDG_DESKTOP_DIR directory, no container is needed.

Comment thread am2pla-site Outdated
# COMMON FUNCTIONS NEEDED TO COMPILE OTHER PAGES
################################################

# Frontmatter so each generated page uses the `category` Jekyll layout,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this am2pla-site script come from the AM database

if you change this one, the next workflow will override it

The change have to be done in AM repository

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this am2pla-site script come from the AM database

if you change this one, the next workflow will override it

The change have to be done in AM repository

Ok, I've marked the PR in the AM repository as ready for review. ivan-hc/AM#2381

@ivan-hc
Copy link
Copy Markdown
Contributor

ivan-hc commented May 22, 2026

The only two files that will be keept in this pull request will be the .html and .js file, because at this state, each workflow, each hour, will overwrite all .md files and the am2pla-site script in this repository.

@andy5995
Copy link
Copy Markdown
Contributor Author

The only two files that will be keept in this pull request will be the .html and .js file, because at this state, each workflow, each hour, will overwrite all .md files and the am2pla-site script in this repository.

Ok, I think I am understanding better. I am testing as best as I can locally now.

@ivan-hc
Copy link
Copy Markdown
Contributor

ivan-hc commented May 22, 2026

Yes. And for now to fix the am2pla-site script is a priority.

It can be executed on the XDG_DESKTOP_DIR directory, no container is needed.

Remember only your XDG_DESKTOP_DIR

simplescreenrecorder-2026-05-23_01.24.19.mp4

Per ivan-hc on Portable-Linux-Apps#144, an hourly workflow runs am2pla-site against AM
main and syncs back, overwriting every .md file in this repo and the
am2pla-site copy itself. The script changes need to land in AM first
(branch pla-site-category-layout); until then, any edits on those
files in this PR are erased within an hour.

Strip the volatile work to keep the PR focused on the only changes
that survive a sync: the new category layout, the search JS, and the
local-testing docs/Gemfile. The supporting script work (frontmatter
emission, awk-based index.md preservation, footer extraction) stays
on AM's pla-site-category-layout branch where it belongs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ivan-hc ivan-hc merged commit 639e280 into Portable-Linux-Apps:main May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants