Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8809141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:47:50+00:00 2026-06-14T02:47:50+00:00

My goal is to create links from any published jekyll page back to its

  • 0

My goal is to create links from any published jekyll page back to its location on Github.

And so, I’d need access to a page’s pathname when constructing this url. However, I don’t see anything in the api for templates that provides this info. I looked at the source for page, but none of the file/path attributes had values, when accessed via the template.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:47:52+00:00Added an answer on June 14, 2026 at 2:47 am

    Update: nowadays you can use {{page.path}}.


    It seems like you can construct your link just fine using the liquid code: {{ page.url }}

    For instance, if you want this page: http://railsdocs.org/pages/get-involved.html to link to this page: https://github.com/dogweather/railsdocs.org/blob/gh-pages/pages/get-involved.md

    Seems like you could add something like:

    [source](https://github.com/dogweather/railsdocs.org/blob/gh-pages/{{page.url | replace:'.html','.md'}})
    

    to the markdown and get the link you want.

    A more general solution:

    Alternatively, we could write a generator that allows a page to access its file name directly. Add this to a .rb file in your _plugins directory:

    module Jekyll
    
      class PagePathGenerator < Generator
        safe true
        ## See post.dir and post.base for directory information. 
        def generate(site)
          site.posts.each do |post|
            post.data['path'] = post.name
          end
    
        end
      end
    
    end
    

    and then we can reliably get the post’s filename as {{ page.path }}. This solution is more robust than converting from the URL, since page names can have characters that get ‘sanitized’ out when converting them to URLs. (Posts would also need their date information, etc added back in). Instead, this plugin gives us direct access to a post’s name.

    A similar strategy could allow us to get the path to the post if that data is also needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to create a list from menu.bin. This is the func: pitem
I need to create a simple web service (being the server). The goal is
Goal: to create a percentage column based off the values of calculated columns. Here's
Duplicate: PHP validation/regex for URL My goal is create a PHP regex for website
I am very new to Json and my goal to create the Json output
My goal is to create a canned email on my server and then send
My goal is to create an entry form (addnew.php) that will allow me to
my goal is to create a sort of Javascript library, if you could call
The goal is to create a mock class which behaves like a db resultset.
My goal is to create an efficient structure to store the most relevant entries

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.