v.karbovnichy
v.karbovnichy

Reputation: 3306

How to get "_pages" referenced at the site root in Jekyll?

I have Jekyll site hosted on GitHub Pages. The file _config.yml has this content (excerpt):

# Defaults
defaults:
  # _pages
  - scope:
      path: "_pages"
      type: "pages"
    values:
      layout: "single"
      read_time: true

So when the site is built, I can open a page by its URL like this: https://repo.github.io/_pages/some-page/

I read all the docs for Jekyll but it is not clear to me how to turn this URL to be https://repo.github.io/some-page/ or maybe https://repo.github.io/pages/some-page/.

Upvotes: 3

Views: 683

Answers (2)

samwize
samwize

Reputation: 27353

For eg. https://repo.github.io/some-page, you can put in _pages and config as such:

collections:
  pages:
    output: true
    permalink: /:name

Upvotes: 1

ashmaroli
ashmaroli

Reputation: 5444

_pages can be seen as collection directory. Therefore by simply having the following config:

collections:
  pages:
    output: true

will give you URLs like https://repo.github.io/pages/some-page.html

To get custom URLs you may add a permalink sub-config:

collections:
  pages:
    output: true
    permalink: /:collection/:path/

will give you URLs like https://repo.github.io/pages/some-page/

For more possibilities, refer the official docs

Upvotes: 5

Related Questions