obsidian-webpage-export icon indicating copy to clipboard operation
obsidian-webpage-export copied to clipboard

Recursive export of linked files

Open emdoe opened this issue 2 years ago • 8 comments

For me, it would be awesome (and super helpful) if we could also recursively export web pages from a given file. For example, suppose we have a document named index.md:

# Index
[[sample]]

and sample.md:

# Sample 
some text...

If we export the file index.md, we can get both index.html and sample.html. One conceivable problem is that we might run into a cycle (e.g. the sample.md also contains a link to the index.md). But we can probably just stop the recursion if we come across a file that has been encountered before.

emdoe avatar Feb 13 '23 22:02 emdoe

So you mean when exporting one file, also export all files that that file references, and then all the ones that than file references and so on? This is a good idea, however probably pretty niche. Thanks for the request and it may be implemented in the future.

KosmosisDire avatar Feb 14 '23 03:02 KosmosisDire

Yes! Thanks, I might be able to do some research in the future as well.

emdoe avatar Feb 14 '23 13:02 emdoe

I, too would really love to see support for this feature.

The obsidian-export package supports this, but is written in Rust and does not support as many Obsidian features as this exporter does (dataview, etc.).

From their README

Using the --start-at argument, you can export just a subset of your vault.

Just thought I would link here in case there is inspiration that can be taken from their code. https://github.com/zoni/obsidian-export

lzilioli avatar Dec 06 '23 03:12 lzilioli

Thanks I do plan to eventually add support for this. But I want to add it in a way that doesn't make the UI confusing, and doesn't hide the feature in a list somewhere.

KosmosisDire avatar Dec 06 '23 03:12 KosmosisDire

If at all possible, I would also like the ability to store multiple export configurations each with their own --start-at index files and configure multiple destination folders, and run those configurations on demand. I have a few different projects that I'd like to publish as separate digital gardens if possible.

In addition, my index files often contain dataview queries that dynamically produce links to other documents within the vault. Ideally the recursive export could resolve the dataview queries and detect that they link to notes, and include those notes as part of the export.

In an ideal world, I would also love an interface where after the recursive file link resolution is complete, and BEFORE publishing, I am given the opportunity to explicitly choose which of the selected files get included in the final publish. I have seen other export plugins solve that last bit of logic via published: true front matter metadata, and I think that would be a fine solution here as well. Ideally the final publish summary would give me an overview of all linked files, and flag the ones that are not published so that I can go add the publish metadata IFF i wish for them to be included in the public export.

lzilioli avatar Dec 14 '23 21:12 lzilioli

Hi, thanks. All these ideas are good and something I will take into consideration. But they also have the potential to introduce a large amount of complexity into the plugin. I'll think about the best way to add these features.

One possiblity would be that instead of having a separate mode where you export starting at a specific file, there is just a button in the current file selection panel that would select all linked files recursively. This would allow you to then modify the selection how you wanted afterwards. I am also planning to add selection "presets" so you have save certain file selections. I think this should solve all of the things you listed above. Let me know what you think about this solution

Thanks again for the suggestions

KosmosisDire avatar Dec 14 '23 21:12 KosmosisDire

I like the idea of being able to click an individual file that I consider to be an "Index" and initiate the recursive export from the menu. As long as I can save this configuration for future re-use, and maybe even add a command to "Publish Site Changes for configuration...", dataview notes are detected and included, and I can specify what frontmatter ket to check for treating a note as "published" for the given export, I think this would meet my needs nicely.

Thank you very much for this plugin!

lzilioli avatar Dec 19 '23 15:12 lzilioli

I also would love this feature

zdaar avatar May 26 '24 19:05 zdaar