Content adapters: Path or Permalink?

Going to use the example in step 3 Content adapters.

When calling the path in templates, should one use .Path or .Permalink/.RelPermalink?

In templates, to link to the page you would use either .Petmalink or .RelPermalink

unsure, what calling means. .Path and (Rel)Permalink are two different things.

  • The .Path is the logical path that refers to a page object. (call it “source”).
    It can be used to find pages in a page tree - see: Path
  • The (Rel)Permalink is a link (reference) to the published page

In my case, both return the same thing e.g example.com/foo/bar with foo being section and bar being the page.

I doubt, the .Path will contain your baseURL. play with some settings to grasp the differences.

taking the referenced example the first book results in:

  • referenced example - nearly the same but mind the trailing /

    The Hunchback of Notre Dame
    .Path:         /books/the-hunchback-of-notre-dame
    .Permalink:    http://localhost:1313/books/the-hunchback-of-notre-dame/
    .RelPermalink: /books/the-hunchback-of-notre-dame/    
    
  • change the baseURL to https://example.com/foo/

    The Hunchback of Notre Dame
    .Path:         /books/the-hunchback-of-notre-dame
    .Permalink:    http://localhost:1313/foo/books/the-hunchback-of-notre-dame/
    .RelPermalink: /foo/books/the-hunchback-of-notre-dame/
    
  • use a permalink books = '/books/:year/:month/:slug/'

    The Hunchback of Notre Dame
    .Path:         /books/the-hunchback-of-notre-dame
    .Permalink:    http://localhost:1313/books/2024/05/the-hunchback-of-notre-dame/
    .RelPermalink: /books/2024/05/the-hunchback-of-notre-dame/
    

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.