Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pages with numeric prefixes get their URLs mangled #1733

Open
ahnlak opened this issue Jul 6, 2023 · 4 comments
Open

Pages with numeric prefixes get their URLs mangled #1733

ahnlak opened this issue Jul 6, 2023 · 4 comments
Assignees

Comments

@ahnlak
Copy link
Contributor

ahnlak commented Jul 6, 2023

Describe the bug

(sorry, me again!)

A page with an initial number (e.g. 1-number-test.md) gets rendered as number-test/index.html - that is to say, when the filename begins with a number, it's considered a prefix and stripped from the resulting URL.

This may be intended behaviour (there seems to be code to actively strip prefixes), but it would be nice if it was configurable (or at least documented).

To reproduce

  1. Create a page with a numeric prefix - e.g. pages/1-number-test.md
  2. Build the site - cecil.phar build
  3. Output appears in _site/number-test/index.html

Expected behavior

I would prefer it to be:

  1. Output appears in _site/1-number-test/index.html

Version

7.43.0

Operating System

Ubuntu 20.04

Relevant log output

No response

@ahnlak ahnlak added the bug label Jul 6, 2023
@ahnlak
Copy link
Contributor Author

ahnlak commented Jul 14, 2023

To follow up on this; I've managed to spot that this behaviour is sort of explained in the docs (confusingly, under Content/Variables), so I guess this is more of a feature request - to add something in config.yml to allow me to retain prefixes in the resulting titles / page ID.

@ahnlak
Copy link
Contributor Author

ahnlak commented Jul 14, 2023

FWIW I do have a workaround - renaming the page to 1 number-test.md (i.e. with a space instead of a hyphen) resolves the problem, so although it would be nice to have a configuration to control prefix behaviour better, it might just be something that needs to be better documented (perhaps under 'File organisation' instead of buried in Variables?)

@ArnaudLigny
Copy link
Member

ArnaudLigny commented Sep 18, 2023

Hello @ahnlak, thanks for your report.

I thought about the problem and asked myself what would be the most practical and effective.

2 options identified for the moment:

  1. Add an option in the configuration to be able to disable this behavior. Disadvantages: many impacts on existing code, should this option be global? per page? by section? by page type? other ?
  2. Change the prefix separator: today it is possible to use "-" or "_". Maybe by removing the "-" and keeping only the "_" it would be enough to distinguish the page title from its prefix?

@ArnaudLigny ArnaudLigny self-assigned this Sep 18, 2023
@ArnaudLigny ArnaudLigny removed the bug label Sep 18, 2023
@ArnaudLigny ArnaudLigny moved this to Todo in Cecil Sep 18, 2023
@ahnlak
Copy link
Contributor Author

ahnlak commented Sep 18, 2023

As you say, it may be tricky to address the problem without impacting existing usage; it's easy enough to work with once you know it's there (I just switched to using spaces after any numeric-prefixed filenames), so perhaps it just needs to be more obviously documented - perhaps under file based routing, where the mapping between filename and URL is explained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants