# IPFS tips and hacks **Published by:** [N00b21337](https://paragraph.com/@n00b21337/) **Published on:** 2023-01-11 **URL:** https://paragraph.com/@n00b21337/ipfs-tips-and-hacks ## Content Preserve base URL for use with smart contractsBy default using IPFS Desktop and uploading files will give your shareable links each time different URL, which is a problem when you want to have base URL and just change the last part of the path per token ID. So to solve that you need to use is "Wrap Filenames and Directory Info around Content" https://dweb-primer.ipfs.io/files-on-ipfs/wrap-directories-around-conte… which in CLI looks like this. $ ipfs add -w mytextfile.txt added QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy mytextfile.txt added QmPvaEQFVvuiaYzkSVUp23iHTQeEUpDaJnP8U7C3PqE57w In IPFS desktop you don't have this option but with Pinata service you have this possibility in UI. Also here is how to use IPNS so you can have fixed base URL even when you change data and add more files https://dweb-primer.ipfs.io/publishing-changes/modify-republish And even more how to use DNSLink for more cleaner version of IPFS URL https://docs.ipfs.io/concepts/dnslink/#publish-content-pathVersions of CID and how to know which one you are usingLet's examine two examples of CIDs in their string form: QmY6yj1GsermExDXoosVE3aSPxdMNYr6aKuw3nA8LoWPRS bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi Multihash formatting and base58btc encoding enabled this first version of the CID, now referred to as Version 0 (CIDv0), and its initial Qm... characters remain easy to spot. The second example starts with b, the base encoding prefix identifier for base32, which is used by default by most implementations of IPFS. If it starts with b it's base32 and is CIDv1. You can convert any CIDv0 to CIDv1, because the implicit prefixes from v0 become explicit in v1. However, because CIDv1 supports multiple codecs and multiple bases and CIDv0 does not, not all CIDv1 can be converted to CIDv0. More info on Anatomy of CIDs https://proto.school/anatomy-of-a-cid/02 Use CID inspector https://cid.ipfs.io/Adding files as folder CID0 and CID1 versionWhen you want to add whole folder to IPFS you need to use one of this two commandsipfs add -r --cid-version=1 . this uses CIDv1 or if you just type in plainipfs add -r . this will add files in your current path and folder where they are with CID0 version. ## Publication Information - [N00b21337](https://paragraph.com/@n00b21337/): Publication homepage - [All Posts](https://paragraph.com/@n00b21337/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@n00b21337): Subscribe to updates - [Twitter](https://twitter.com/0xCardinalError): Follow on Twitter