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

Creation of namespaced links with relative URL #1

Closed
randomor opened this issue Nov 3, 2023 · 6 comments
Closed

Creation of namespaced links with relative URL #1

randomor opened this issue Nov 3, 2023 · 6 comments
Labels
documentation Improvements or additions to documentation

Comments

@randomor
Copy link

randomor commented Nov 3, 2023

Just discovered this from the forum, do we have a way to support relative URLs when creating namespaced page references? Is this possible with logseq plugin api?

Like when you type [[./Ideas]] from [[CoolProject]], it will automatically expand to [[Cool Project/Ideas]]?

I’ve found I often need to do this, as there are usually multiple projects that I need to create sub pages for.

@stdword
Copy link
Owner

stdword commented Nov 4, 2023

Hello!
This plugin is totally not suited for this.
But you can use another one: 🏛 Full House Templates plugin

Steps

  1. Create special template:

    - template:: P
        - `[c.page.name + '/' + c.args.$1]`
    
  2. Use it to create links to sub-pages:

    {{renderer :template, P, sub page}}
    
  3. Use :commands in config.edn to create a shortcut with carriage positioning:

    :commands [
      ["Sub Page", [[:editor/input "{{renderer :template, P, }}" {:backward-pos 2}]] ]
    ]
    
  4. Use /-command to create sub pages fastly:

  5. Enjoy and give a star to both plugins 🤗 ❤️

@stdword stdword added the documentation Improvements or additions to documentation label Nov 4, 2023
@randomor
Copy link
Author

randomor commented Nov 4, 2023

Thanks for the detailed information. 🙏The plugin is close but what a missed opportunity, I think logseq could make the creation of relative references so much easier if I can just type [[./subpage]]. Is this possible with the plugin api or something one has to submit a feature request to the logseq core?

@stdword
Copy link
Owner

stdword commented Nov 4, 2023

  1. Feature request to Logseq is always the part of solution. Logseq team should accept that feature. But this is a possible way.
  2. Plugin API directly didn't offer a way to modify rendering of links. But this can be achieved with some repeating parsing of current block or via slash command.

Give it a chance for my solution. It is literally not so different in terms of pressing keys:
/pa<Enter><Sub page name> has the same key pressing length as [[./<Sub page name> — 4 keys pressing and the name.

@randomor
Copy link
Author

randomor commented Nov 5, 2023

I'll give this a try. The keystrokes maybe the same but the cognitive distance is vast. I'm used to think in relative urls and remembering an additional shortcut is ok but just not so natural to me. Thanks for being so helpful! I'll close this issue for now.

@randomor randomor closed this as completed Nov 5, 2023
@stdword
Copy link
Owner

stdword commented Nov 22, 2023

Hey, @randomor! Check out something very similar to your request:
https://github.com/stdword/logseq13-shorten-my-links#2-to-have-a-very-fast-way-of-creating-or-referencing-sub-pages

@randomor
Copy link
Author

@stdword wait did you create that? Fresh out of the oven. That's awesome. I'll play with it and let you know if I have any other ideas.

@stdword stdword changed the title [Feature Request] Support creation of namespaced links with relative URL Creation of namespaced links with relative URL Feb 9, 2024
@stdword stdword pinned this issue Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants